solved hackerrank's designer pdf viewer problem

Signed-off-by: ayham <altffour@protonmail.com>
This commit is contained in:
ayham 2021-05-09 12:43:54 +03:00
parent 368e5d2f78
commit cc5507c727
No known key found for this signature in database
GPG Key ID: 81D38F7122AFCC94
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int max_height = -1;
vector<int> heights(26);
string word;
for (int i = 0; i < heights.size(); i++) cin >> heights[i];
cin >> word;
for (auto letter : word) if (heights[letter-'a'] >= max_height) max_height = heights[letter-'a'];
cout << max_height * word.size() << endl;
return 0;
}