1. Code
#include <iostream>
#include <string>
using namespace std;
int main(void) {
int ch[26] = {3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,8,9,9,9,10,10,10,10};
string word;
int time = 0;
cin >> word;
for (int i=0 ; i<word.length() ; i++) {
time += ch[word[i]-65];
}
cout << time << '\n';
return 0;
}
2. Result
Runtime : 0 ms, Memory usage : 2024 KB
(Runtime can be different by a system even if it is a same code.)