#include <iostream>
#include <cstring>
using namespace std;
int keyboard[26]={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 last=-1;
int wait_sum=0;
for(int i=0;i<str.length();i++){
int charnum=(int)(str[i]-'a');
if(keyboard[charnum]==last)
wait_sum+=2;
last=keyboard[charnum];
int wait=0;
for(int j=charnum;j>=0;j--)
if(keyboard[j]==keyboard[charnum])
wait++;
else
break;
wait_sum+=wait;
}
cout<<wait_sum<<endl;
}
}