func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     string s;     cin >> n >> s;     n += 3;     vector<int> a(n), la(n), ra(n), lmi(n), lma(n), rmi(n), rma(n);     int j = 2;     for (int i = 0; i < n - 3; i++) {       if (s[i] ==  ( ) {         a[j] = 1;       } else if (s[i] ==  ) ) {         a[j] = -1;       } else if (s[i] ==  R ) {         j++;       } else if (s[i] ==  L ) {         j--;         j = max(j, 2);       } else {         a[j] = 0;       }       la[j] = la[j - 1] + a[j];       ra[j] = ra[j + 1] - a[j];       lmi[j] = min(lmi[j - 1], la[j]);       lma[j] = max(lma[j - 1], la[j]);       rmi[j] = min(rmi[j + 1], ra[j]);       rma[j] = max(rma[j + 1], ra[j]);       if (lmi[j] >= 0 && rmi[j + 1] >= 0 && la[j] == ra[j + 1]) {         cout << max(lma[j], rma[j + 1]) <<    ;       } else {         cout <<  -1  ;       }     }     cout <<   n ;     return 0;   }   