func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 600009;   const long long MOD = 1e9 + 7;   class {    public:     int n, F[MAXN], G[MAXN];     string s;     int Min;     void solve() {       cin >> n >> s;       for (int i = 1; i <= n; ++i) {         if (s[i - 1] ==  ( )           F[i] = F[i - 1] + 1;         else           F[i] = F[i - 1] - 1;         Min = min(Min, F[i]);       }       for (int i = n + 1; i <= n + n; ++i) {         if (s[i - n - 1] ==  ( )           F[i] = F[i - 1] + 1;         else           F[i] = F[i - 1] - 1;         Min = min(Min, F[i]);       }       if (F[n] != 0) {         cout << 0 <<   n  << 1 <<     << 1 <<   n ;         return;       }       int L, R;       for (int i = 0; i <= n; ++i) {         if (F[i] == Min) {           L = i, R = i + n - 1;         }       }       int tmp = 0;       for (int i = L; i <= R; ++i) {         if (F[i] == Min) tmp++;       }       int count = 0, nl = 0, nr, ans = tmp, ansl = 1, ansr = 0;       for (int i = L; i <= R; ++i) {         if (F[i] - 2 >= Min) {           if (!nl)             nl = nr = i;           else             nr = i;           if (F[i] - 2 == Min) count++;         } else {           nl = 0;           count = 0;         }         if (tmp + count > ans) {           ans = tmp + count;           ansl = nl;           ansr = nr;         }       }       count = 0;       nl = 0;       for (int i = L; i <= R; ++i) {         if (F[i] - 2 >= Min - 1) {           if (!nl)             nl = nr = i;           else             nr = i;           if (F[i] - 2 == Min - 1) count++;         } else {           nl = count = 0;         }         if (count > ans) {           ans = count;           ansl = nl;           ansr = nr;         }       }       ansr++;       if (ansl > n) ansl -= n;       if (ansr > n) ansr -= n;       cout << ans <<   n  << ansl <<     << ansr <<   n ;     }   } NSPACE;   int main() {     ios_base::sync_with_stdio(false);     cout.tie(0);     cin.tie(0);     NSPACE.solve();   }   