Solution to the problem number 978B of Codeforces - 978B.

Any questions do not hesitate to contact.

#include <bits/stdc++.h>
#define INF 0x3F3F3F3F
using namespace std;

int main() {
        int cases; cin>>cases;
        string va; cin>>va;
        int res = 0,cx=0;
        for(int i=0; i<cases;i++)
        {
            if(va[i]=='x') cx++;
            else { if(cx>2) res+=cx-2; cx=0;}
        }
        if(cx>2) res+=cx-2;
        cout<<res;
    return 0;
}

Don't miss anything.

Keep in touch with Isaac Lozano Osorio!