//手机键盘 清华 2024/1/4
#include <iostream>
using namespace std;
int main() {
string str;
int len, count;
int hit_wait[26] = {//数组记录每个字母对应的敲击时间
1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3,
1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4
};
while (cin >> str) {
count = hit_wait[str[0]-'a'];
len = str.length();
for (int i = 1; i < len; i++) {
count += hit_wait[str[i] - 'a'];
if((str[i]-str[i-1])==(hit_wait[str[i]-'a']-hit_wait[str[i-1]-'a'])){
//此处注意判断条件的书写
count+=2;
}
}
cout << count << endl;
}
return 0;
}

京公网安备 11010502036488号