func_code_string: #include <bits/stdc++.h>   using namespace std;   void test_case() {     int n, i, cnt;     cin >> n;     string str;     cin >> str;     cnt = 0;     vector<int> c(n + 5, 0);     vector<int> flag(n + 5, 0);     int fl = 0;     for (i = n - 1; i >= 0; i--) {       if (str[i] ==  ( )         cnt++;       else         cnt--;       c[i] = cnt;       if (cnt > 0) fl = 1;       flag[i] = fl;     }     cnt = 0;     int ans = 0;     fl = 0;     for (i = 0; i < n; i++) {       if (fl == 0 && str[i] ==  )  && cnt + 1 == -c[i + 1] && cnt + 1 >= 0 &&           flag[i + 1] == 0) {         ans++;       } else if (fl == 0 && str[i] ==  (  && cnt - 1 == -c[i + 1] &&                  cnt - 1 >= 0 && flag[i + 1] == 0) {         ans++;       }       if (str[i] ==  ( )         cnt++;       else if (str[i] ==  ) )         cnt--;       if (cnt < 0) fl = 1;     }     cout << ans <<   n ;     return;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     ;     int t;     t = 1;     while (t--) {       test_case();     }   }   