my code
#include
#include
using namespace std;
int main()
{
int T;long long sum=0;
string s;
long long int A[26],B[26];
cout<<“Enter no. of test cases: “;
cin>>T;
while(T!=0)
{
cout<<”\nEnter cost of letters:\n”;
for(int i=0;i<26;i++)
{
cin>>A[i];
B[i]=0;
}
cout<<"\nEnter the string: ";
cin>>s;
for(long int i=0;i<s.length();i++)
{
int is=int(s[i]-97);
B[is]++;
}
for(int i=0;i<26;i++)
{
if(B[i]==0)
sum=sum+A[i];
}
if(sum==0)
cout<<" 0";
else
cout<<"\n\n "<<sum;
sum=0;
T--;
}
}