func_code_string: #include <bits/stdc++.h>   using namespace std;   int dp[5005][5005];   string s;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> s;     memset(dp, -1, sizeof dp);     int ans = 0;     for (int i = 0; i < s.size(); i++) {       int can_rev = 0;       int cur = 0;       for (int j = i; j < s.size(); j++) {         if (cur == 0) ans++;         if (s[j] ==  ( ) {           cur++;         } else if (s[j] ==  ) ) {           cur--;           if (cur < 0) {             if (can_rev == 0) break;             can_rev--;             cur += 2;           }         } else {           if (cur > 0) {             cur--;             can_rev++;           } else {             cur++;           }         }       }       if (cur == 0) ans++;       ans--;     }     cout << ans <<   n ;     return 0;   }   