func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MXN = 1000100;   const long long inf = 1e15;   const int mod = 1000000007;   char s[MXN];   int was[2 * MXN];   int main() {     scanf( %s , s);     int n = strlen(s);     if (s[n - 1] ==  L ) {       for (int i = 0; i < (n); i++) {         if (s[i] ==  R )           s[i] =  L ;         else           s[i] =  R ;       }     }     for (int i = 0; i < (n); i++) {       if (s[i] ==  R )         s[i] = 1;       else         s[i] = -1;     }     int cur = 0;     int mn = 0, mx = 0, cmx = 0, tmx = 0;     for (int i = 0; i < (n); i++) {       was[cur + n] = 1;       cur += s[i];       tmx = max(tmx, cur);       if (cur < mn) {         mn = cur;         mx = -1e9;         cmx = 0;       }       if (cur > mx) {         mx = cur;         cmx = 1;       } else if (cur == mx) {         cmx++;       }     }     if (!was[cur + n]) {       printf( 1 n );       return 0;     }     if (cur == mx && cmx == 1) {       if (cur - mn > tmx) {         printf( %d n , cur - mn - tmx);         return 0;       }     }     printf( 0 );   }   