#include <bits/stdc++.h>   using namespace std;   const int mx = 1e5 + 10;   long long len, ans, val[26], s[mx];   char str[mx];   map<pair<long long, char>, long long> dp;   int main() {     for (int i = 0; i < 26; i++) scanf( %I64d , &val[i]);     scanf( %s , str);     len = strlen(str);     s[0] = val[str[0] -  a ];     for (int i = 1; i < len; i++) s[i] = s[i - 1] + val[str[i] -  a ];     for (int i = 0; i < len; i++) {       ans += dp[make_pair(s[i - 1], str[i])];       dp[make_pair(s[i], str[i])]++;     }     printf( %I64d n , ans);     return 0;   }   