func_code_string: #include <bits/stdc++.h>   using namespace std;   long long ar[500005];   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %lld , &ar[i]);     }     string s;     cin >> s;     long long gain = 0;     long long loss = 0;     long long bob = 0;     for (int i = 0; i < s.length(); i++) {       if (s[i] ==  B ) {         bob += ar[i];       }     }     long long ma = 0;     for (int i = 0; i < s.length(); i++) {       if (s[i] ==  A ) {         gain += ar[i];       } else {         loss += ar[i];       }       ma = max(ma, gain - loss);     }     gain = 0;     loss = 0;     for (int i = s.length() - 1; i >= 0; i--) {       if (s[i] ==  A ) {         gain += ar[i];       } else {         loss += ar[i];       }       ma = max(ma, gain - loss);     }     bob += ma;     printf( %lld , bob);   }   