#include #include #include #include #include #include #include int main(){ int n = 26; int *h = malloc(sizeof(int) * n); for(int h_i = 0; h_i < n; h_i++){ scanf("%d",&h[h_i]); } char* word = (char *)malloc(512000 * sizeof(char)); scanf("%s",word); int result; int totalwidth = strlen(word); int totalheight = 0; int value; int num; for (int i = 0; i < strlen(word); i++) { num = word[i] - 'a'; value = h[num]; if (value > totalheight) totalheight = value; } result = totalwidth * totalheight; printf("%d\n",result); return 0; }