func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     cin.get();     string s;     getline(cin, s);     vector<int> pref(n);     for (int i = 0; i < n; ++i) {       if (i != 0) pref[i] = pref[i - 1];       pref[i] += s[i] ==  (  ? +1 : -1;     }     if (pref[n - 1] != 0) {       cout <<  0 n1 1 n ;       return 0;     }     int min_pos = min_element(pref.begin(), pref.end()) - pref.begin() + 1;     if (min_pos == n) min_pos = 0;     rotate(s.begin(), s.begin() + min_pos, s.end());     for (int i = 0; i < n; ++i) {       pref[i] = 0;       if (i != 0) pref[i] = pref[i - 1];       pref[i] += s[i] ==  (  ? +1 : -1;       assert(pref[i] >= 0);     }     vector<int> merged;     vector<vector<int>> pos(2);     vector<vector<int>> cnt(n, vector<int>(3));     pos[0].emplace_back(-1);     merged.emplace_back(-1);     for (int i = 0; i < n; ++i) {       if (i != 0) cnt[i] = cnt[i - 1];       if (pref[i] < 3) {         cnt[i][pref[i]] += 1;         if (pref[i] < 2) {           merged.emplace_back(i);           pos[pref[i]].emplace_back(i);         }       }     }     tuple<int, int, int> ans((int)pos[0].size() - 1, 0, 0);     for (int i = 0; i + 1 < (int)pos[0].size(); ++i) {       int l = pos[0][i], r = pos[0][i + 1];       int cnt_1 = cnt[r][1] - (l >= 0 ? cnt[l][1] : 0);       ans = max(ans, make_tuple(cnt_1, l + 1, r));     }     for (int i = 0; i + 1 < (int)merged.size(); ++i) {       int l = merged[i], r = merged[i + 1];       if (s[l + 1] == s[r]) continue;       int cnt_2 = cnt[r][2] - (l >= 0 ? cnt[l][2] : 0);       ans = max(ans, make_tuple(cnt_2 + (int)pos[0].size() - 1, l + 1, r));     }     int res, l, r;     tie(res, l, r) = ans;     (l += min_pos) %= n;     (r += min_pos) %= n;     cout << res << endl;     cout << 1 + l <<     << 1 + r << endl;   }   