24-4-9
感觉好难写qwq
/*
if (num[t] != last)
{
while (r != num[t])
{
int r = 1, l = 0;
if (num[r] - num[l])
{
l = r;
l ++;
}
}
}
last = c;
*/
#include <iostream>
using namespace std;
const int N = 1010;
int num[] = {
2,2,2,3,3,3,4,4,4,5,5,5,
6,6,6,7,7,7,7,8,8,8,9,9,9,9
};
int main()
{
string str;
while (cin >> str)
{
int res = 0, last = -1;
for (auto c : str)
{
int t = c - 'a';
// 从后往前看看有几个
for (int i = t; i >= 0; i -- )
{
if (num[i] == num[t]) res ++;
else break;
}
// str 的前一个 和 后一个比
if (num[last] == num[t]) res += 2;
last = t;
}
cout << res << endl;
}
return 0;
}