func_code_string: #include <bits/stdc++.h>   using namespace std;   void solve_test() {     string s;     cin >> s;     int n = int(s.length());     int total = 0;     long long ans = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  + )         total++;       else         total--;       if (total < 0) {         total++;         ans += i + 1;       }     }     cout << ans + n <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int tests = 1;     cin >> tests;     while (tests--) solve_test();     return 0;   }   