func_code_string: #include <bits/stdc++.h>   using namespace std;   char s[5010];   int main() {     scanf( %s , s);     int n = (int)strlen(s);     int res = 0;     for (int i = 0; i < n; i++) {       int cnt1 = 0, cnt2 = 0;       for (int j = i; j < n; j++) {         if (s[j] ==  ( ) cnt1++;         if (s[j] ==  ) ) cnt1--;         if (s[j] ==  ? ) cnt2++;         if (cnt2 && cnt2 > cnt1) cnt2--, cnt1++;         if (cnt1 < 0) break;         if (cnt2 == cnt1) res++;       }     }     printf( %d , res);     return 0;   }   