You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
443 B
C++
22 lines
443 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 105;
|
|
char s[N];
|
|
int main()
|
|
{
|
|
int n, cnt, ans;
|
|
while (~scanf("%d%s", &n, s))
|
|
{
|
|
cnt = ans = 0;
|
|
for (int i = 0; i <= n; i++)
|
|
if (s[i] == 'x')
|
|
cnt++;
|
|
else
|
|
{
|
|
ans += max(0, cnt - 2);
|
|
cnt = 0;
|
|
}
|
|
printf("%d\n", ans);
|
|
}
|
|
return 0;
|
|
} |