Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. string b;
  6. string a ="abcdefghijklmnopqrstuvwxyz";
  7. char ss;
  8. int p,q,i,j,k,sum;
  9. vector <pair <char,int> > v;
  10. int n=a.size();
  11. cin>>b;
  12. for (i=0;i<n;i++)
  13. {
  14. scanf("%d",&p);
  15. ss=a[i];
  16. v.push_back({ss,p});
  17. }
  18. int s=v.size();
  19. q=b.size();
  20. sum=0;
  21. for (j=0;j<q;j++)
  22. {
  23. for (i=0;i<s;i++)
  24. {
  25. if (v[i].first==b[j])
  26. {
  27. sum=sum+v[i].second;
  28. }
  29. }
  30. }
  31. printf("%d\n",sum);
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement