code-problem-solutions/hackerrank.designer.pdf.viewer.cpp
ayham cc5507c727
solved hackerrank's designer pdf viewer problem
Signed-off-by: ayham <altffour@protonmail.com>
2021-05-09 12:43:54 +03:00

14 lines
352 B
C++

#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;
}