func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     int a, b, p, pos;     int i, cost, j, k, l;     string s;     while (t--) {       cin >> a >> b >> p;       cost = 0;       cin >> s;       pos = s.length() - 2;       i = s.length() - 2;       if (s[i] ==  A ) {         cost += a;         if (cost > p) {           cout << s.length() << endl;           continue;         }       }       if (s[i] ==  B ) {         cost += b;         if (cost > p) {           cout << s.length() << endl;           continue;         }       }       while (i > 0) {         if (s[i] == s[i - 1]) {           i--;           pos = i;         }         if (s[i] != s[i - 1] && i > 0) {           if (s[i - 1] ==  A ) {             cost += a;           }           if (s[i - 1] ==  B ) {             cost += b;           }           if (cost <= p) {             pos = i - 1;             i--;           }           if (cost > p) {             break;           }         }       }       cout << pos + 1 << endl;     }     return 0;   }   