-
双指针暴力即可
#include<iostream>
using namespace std;
int main()
{
int n;cin>>n;
string a;cin>>a;
int l=0,r=1;
int ans=0;
while(l<n&&r<n)
{
if(a[l]=='x'&&a[r]=='x'&&l<n&&r<n)r++;
while(a[l]=='x'&&a[r]=='x'&&l<n&&r<n)r++,ans++;
if(l>=n||r>=n)break;
if(a[r]!='x'&&l<n&&r<n)l=r;
while(a[l]!='x'&&l<n&&r<n)l++;
r=l+1;
}
cout<<ans<<endl;
return 0;
}
//2021-19:14