Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
while(s.length() >= 3 && s.find("xxx") != string::npos) {
int idx = s.find("xxx");
s.erase(idx, 1);
}
cout << n - s.length() << endl;
return 0;
}
Copy The Code &
Try With Live Editor
Input
6
xxxiii
xxxiii
Output
1
Demonstration
Codeforces Solution-B. File Name-Solution in C, C++, Java, Python