#include <map>
#include <string.h>
#include <iostream>
using namespace std;
int main() {
int front = 0;
int res = 0;
string str;
multimap<char, int>::iterator it;
multimap<char, int> dict{
{' ', 0},
{'a', 2},{'b', 2},{'c', 2},
{'d', 3},{'e', 3},{'f', 3},
{'g', 4},{'h', 4},{'i', 4},
{'j', 5},{'k', 5},{'l', 5},
{'m', 6},{'n', 6},{'o', 6},
{'p', 7},{'q', 7},{'r', 7},{'s', 7},
{'t', 8},{'u', 8},{'v', 8},
{'w', 9},{'x', 9},{'y', 9},{'z', 9}
};
while (cin >> str) {
res = 0;
front = -1;
for (int i = 0; i < str.length(); ++i) {
it = dict.find(str[i]);
if (front == dict.find(str[i])->second) res += 2;
int tmp = dict.find(str[i])->second;
while (tmp == it->second) {
++ res;
-- it;
}
front = tmp;
}
cout << res << endl;
}
return 0;
}