func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 1e6 + 1;   const int MOD = 1e9 + 7;   struct node {     int n4, n7, n47, n74;   };   bool tab[MAX], lazy[4 * MAX];   int n, q;   node seg[4 * MAX];   void build(int v = 1, int l = 0, int r = n - 1) {     if (l == r) {       seg[v].n7 = tab[l];       seg[v].n4 = !tab[l];       seg[v].n47 = seg[v].n74 = 1;       return;     }     int mid = (l + r) / 2;     build(2 * v, l, mid);     build(2 * v + 1, mid + 1, r);     seg[v].n7 = seg[2 * v].n7 + seg[2 * v + 1].n7;     seg[v].n4 = seg[2 * v].n4 + seg[2 * v + 1].n4;     seg[v].n47 = max(max(seg[2 * v].n4 + seg[2 * v + 1].n47,                          seg[2 * v].n7 + seg[2 * v + 1].n7),                      seg[2 * v].n47 + seg[2 * v + 1].n7);     seg[v].n74 = max(max(seg[2 * v].n74 + seg[2 * v + 1].n4,                          seg[2 * v].n7 + seg[2 * v + 1].n7),                      seg[2 * v].n7 + seg[2 * v + 1].n74);   }   void up(int v, int l, int r, int a, int b) {     if (lazy[v]) {       swap(seg[v].n4, seg[v].n7);       swap(seg[v].n47, seg[v].n74);       if (l != r) {         lazy[2 * v + 1] = !lazy[2 * v + 1];         lazy[2 * v] = !lazy[2 * v];       }       lazy[v] = 0;     }     if (l > b || r < a) return;     if (l >= a && r <= b) {       swap(seg[v].n4, seg[v].n7);       swap(seg[v].n47, seg[v].n74);       if (l != r) {         lazy[2 * v + 1] = !lazy[2 * v + 1];         lazy[2 * v] = !lazy[2 * v];       }       return;     }     int mid = (l + r) / 2;     up(2 * v, l, mid, a, b);     up(2 * v + 1, mid + 1, r, a, b);     seg[v].n7 = seg[2 * v].n7 + seg[2 * v + 1].n7;     seg[v].n4 = seg[2 * v].n4 + seg[2 * v + 1].n4;     seg[v].n47 = max(max(seg[2 * v].n4 + seg[2 * v + 1].n47,                          seg[2 * v].n7 + seg[2 * v + 1].n7),                      seg[2 * v].n47 + seg[2 * v + 1].n7);     seg[v].n74 = max(max(seg[2 * v].n74 + seg[2 * v + 1].n4,                          seg[2 * v].n7 + seg[2 * v + 1].n7),                      seg[2 * v].n7 + seg[2 * v + 1].n74);   }   int main() {     cin.tie(0);     ios_base::sync_with_stdio(0);     cin >> n >> q;     for (int i = 0; i < n; ++i) {       char x;       cin >> x;       tab[i] = ((x -  0 ) & 1);     }     build();     while (q--) {       string s;       cin >> s;       if (s[0] ==  c )         cout << seg[1].n47 <<   n ;       else {         int a, b;         cin >> a >> b;         up(1, 0, n - 1, a - 1, b - 1);       }     }   }   