#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ vector alphabet(26); string word; for(int i = 0; i < 26; i++) cin >> alphabet[i]; cin >> word; int max = 0; for(int i = 0; i < word.length(); i++){ if(alphabet[word[i]-'a']>max) max = alphabet[word[i]-'a']; } //cout << endl; cout << max * word.length(); return 0; }