Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //920
- #include <cstdio>
- char s[101];
- int n;
- int main(void) {
- FILE* fin = fopen("input.txt", "r");
- FILE* fout = fopen("output.txt", "w");
- fscanf(fin, "%d%s", &n, s);
- fclose(fin);
- int x = 0, out = 0;
- for (int i = 0; i < n; ++ i) {
- if (s[i] == 'x')
- ++ x;
- else if (x > 2) {
- out += x - 2;
- x = 0;
- }
- else
- x = 0;
- }
- if (x > 2)
- out += x - 2;
- fprintf(fout, "%d\n", out);
- fclose(fout);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement