Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- char s[301488];
- bool is_dot[301488];
- int answer = 0;
- void zahuyach(int whe, char wha)
- {
- if (wha == '.' && ! is_dot[whe])
- {
- answer += is_dot[whe - 1];
- answer += is_dot[whe + 1];
- }
- if (wha != '.' && is_dot[whe])
- {
- answer -= is_dot[whe - 1];
- answer -= is_dot[whe + 1];
- }
- is_dot[whe] = (wha == '.');
- }
- int main()
- {
- int len, q;
- scanf("%d %d", &len, &q);
- scanf("%s", &s[1]);
- for (int i = 1; i <= len; ++i)
- {
- zahuyach(i, s[i]);
- }
- while (q-- > 0)
- {
- int whe; char wha;
- scanf("%d %c", &whe, &wha);
- zahuyach(whe, wha);
- printf("%d\n", answer);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement