Advertisement
egormerk

Printer

Mar 7th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int a[52], N, sum = 0;
  9.     char b[52];
  10.     string s;
  11.     cin >> N;
  12.     for (int i = 0; i < N; i++) {
  13.         cin >> b[i] >> a[i] >> a[i+26];
  14.         b[i+26] = b[i] - 32;
  15.     }
  16.     cin >> s;
  17.     for (int i = 0; i < s.length(); i++) {
  18.         for (int k = 0; k < 52; k++) {
  19.             if (s[i] == b[k]) sum+=a[k];
  20.         }
  21.     }
  22.     cout << sum;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement