func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxN = 2 * 300000 + 1000;   int block[maxN], start[maxN], fin[maxN];   int main() {     ios::sync_with_stdio(0);     ;     int n, m;     cin >> n >> m;     string s;     cin >> s;     set<int> st;     st.insert(-1);     st.insert(n);     for (int i = 0; i < n; i++) {       if (s[i] !=  . ) st.insert(i);     }     int f = 0;     int cur = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  . )         cur++;       else {         if (cur) f += cur - 1;         cur = 0;       }     }     if (cur) f += cur - 1;     while (m--) {       int pos;       char c;       cin >> pos >> c;       pos--;       if (c ==  . ) {         auto left = st.lower_bound(pos);         if (*left != pos) {           cout << f <<   n ;           continue;         }         left--;         int l = *left;         int r = *st.upper_bound(pos);         int sub = r - pos - 2;         if (sub > 0) f -= sub;         sub = pos - l - 2;         if (sub > 0) f -= sub;         st.erase(pos);         sub = r - l - 2;         if (sub > 0) f += sub;       } else {         auto left = st.lower_bound(pos);         if (*left == pos) {           cout << f <<   n ;           continue;         }         left--;         int l = *left;         int r = *st.lower_bound(pos);         int sub = r - l - 2;         f -= sub;         sub = pos - l - 2;         if (sub > 0) f += sub;         sub = r - pos - 2;         if (sub > 0) f += sub;         st.insert(pos);       }       cout << f <<   n ;     }   }   