func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   const long long N = 1e5 + 5;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     string s;     cin >> s;     vector<long long> pref(n + 2), suff(n + 2);     for (long long i = 1; i <= n; i++) {       if (s[i - 1] ==  G ) {         pref[i] = 1;         pref[i] += pref[i - 1];       }     }     for (long long i = n; i >= 1; i--) {       if (s[i - 1] ==  G ) {         suff[i] = 1;         suff[i] += suff[i + 1];       }     }     long long ans = 0;     long long cnt = 0;     for (long long i = 1; i <= n; i++) {       if (s[i - 1] ==  G ) cnt++;       ans = max(ans, pref[i]);     }     for (long long i = 1; i <= n; i++) {       if (s[i - 1] ==  S ) {         if (i == 4) {           debug() <<   [                    <<  pref[i - 1]                        :                     << (pref[i - 1])                   <<  ]                          [                    <<  suff[i + 1]                        :                     << (suff[i + 1]) <<  ]  ;         }         if (pref[i - 1] + suff[i + 1] < cnt)           ans = max(ans, pref[i - 1] + suff[i + 1] + 1);         else if (pref[i - 1] + suff[i + 1] == cnt) {           ans = max(ans, pref[i - 1] + suff[i + 1]);         }       }     }     cout << ans <<   n ;     return 0;   }   