#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 3;   int n, m, i, j, k, l, r, s, t, d, u, ii, jj, x, y, z, lz[4 * N], h[N];   char c[100];   pair<pair<int, int>, pair<int, int> > first[4 * N];   void init(int root, int bas, int son) {     if (bas == son) {       if (h[bas] == 4)         first[root].first.first = 1;       else         first[root].first.second = 1;       first[root].second.first = first[root].second.second = 1;       return;     }     init((root + root), bas, (bas + son >> 1));     init(((root + root) + 1), (bas + son >> 1) + 1, son);     first[root].first.first =         first[(root + root)].first.first + first[((root + root) + 1)].first.first;     first[root].first.second = first[(root + root)].first.second +                                first[((root + root) + 1)].first.second;     first[root].second.first = max(first[(root + root)].second.first +                                        first[((root + root) + 1)].first.second,                                    first[(root + root)].first.first +                                        first[((root + root) + 1)].second.first);     first[root].second.second = max(first[(root + root)].second.second +                                         first[((root + root) + 1)].first.first,                                     first[(root + root)].first.second +                                         first[((root + root) + 1)].second.second);   }   void push(int root, int bas, int son) {     if (lz[root] and bas != son) {       lz[((root + root) + 1)] = 1 - lz[((root + root) + 1)];       lz[(root + root)] = 1 - lz[(root + root)];       swap(first[(root + root)].first.first, first[(root + root)].first.second);       swap(first[((root + root) + 1)].first.first,            first[((root + root) + 1)].first.second);       swap(first[((root + root) + 1)].second.first,            first[((root + root) + 1)].second.second);       swap(first[(root + root)].second.first, first[(root + root)].second.second);     }     lz[root] = 0;   }   void g(int root, int bas, int son) {     push(root, bas, son);     if (x > son or y < bas) return;     if (x <= bas and y >= son) {       swap(first[root].first.first, first[root].first.second);       swap(first[root].second.first, first[root].second.second);       lz[root] = 1;       return;     }     g((root + root), bas, (bas + son >> 1));     g(((root + root) + 1), (bas + son >> 1) + 1, son);     first[root].first.first =         first[(root + root)].first.first + first[((root + root) + 1)].first.first;     first[root].first.second = first[(root + root)].first.second +                                first[((root + root) + 1)].first.second;     first[root].second.first = max(first[(root + root)].second.first +                                        first[((root + root) + 1)].first.second,                                    first[(root + root)].first.first +                                        first[((root + root) + 1)].second.first);     first[root].second.second = max(first[(root + root)].second.second +                                         first[((root + root) + 1)].first.first,                                     first[(root + root)].first.second +                                         first[((root + root) + 1)].second.second);   }   int main() {     cin >> n >> m;     for (i = 1; i <= n; i++) {       scanf(  %c , &c[0]);       if (c[0] ==  4 ) h[i] = 4;     }     init(1, 1, n);     while (m--) {       scanf( %s , c);       if (c[0] ==  c )         printf( %d n , first[1].second.first);       else {         scanf( %d%d , &x, &y);         g(1, 1, n);       }     }   }