func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 300002;   int n, m, l[MAXN * 4], r[MAXN * 4], d[MAXN * 4], id[MAXN];   string s;   void input() {     scanf( %d%d , &n, &m);     cin.ignore(1);     getline(cin, s);     s =  0  + s;   }   void init(int x, int left, int right) {     l[x] = left;     r[x] = right;     if (left == right) {       d[x] = 0;       id[left] = x;       return;     }     int mid = (left + right) / 2;     init(x * 2, left, mid);     init(x * 2 + 1, mid + 1, right);     d[x] = d[x * 2] + d[x * 2 + 1];     if (s[mid] ==  .  && s[mid + 1] ==  . ) d[x]++;   }   void update(int a) {     int x = id[a];     x /= 2;     while (x > 0) {       d[x] = d[x * 2] + d[x * 2 + 1];       if (s[r[x * 2]] ==  .  && s[l[x * 2 + 1]] ==  . ) d[x]++;       x /= 2;     }   }   int main() {     input();     init(1, 1, n);     int a;     char b;     for (int q = 1; q <= m; q++) {       scanf( %d %c , &a, &b);       if ((s[a] ==  .  && b ==  . ) || (s[a] !=  .  && b !=  . )) {         printf( %d n , d[1]);         continue;       }       s[a] = b;       update(a);       printf( %d n , d[1]);     }   }   