P1765 手机
#include <bits/stdc++.h>
using namespace std;
const int N = 26;
//常数字典
int a[N] = {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};
int cnt;
string s;
int main() {
//输入
getline(cin, s);
//遍历每一个
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 'a' && s[i] <= 'z') cnt += a[s[i] - 'a'];//计数思路增加个数
if (s[i] == ' ') cnt++;
}
cout << cnt << endl;
return 0;
}