#include <iostream>
#include <vector>
using namespace std;

vector<string>v;

int getTime(string s){
    int time = 0;
    int lastBlock = -1;//上一块的位置为-1
    for(int i = 0;i<s.length();i++){
        //在v中找到该元素
        for(int j = 0;j<v.size();j++){
            int index = v[j].find(s[i]);
            if(index != -1){
                //该元素被找到
                time+=index+1;
                //如果是同一个按键,再加两秒
                if(j == lastBlock)
                    time+=2;
                lastBlock = j;
                break;
            }
        }
    }
    return time;
}

int main() {
    v.push_back("abc");
    v.push_back("def");
    v.push_back("ghi");
    v.push_back("jkl");
    v.push_back("mno");
    v.push_back("pqrs");
    v.push_back("tuv");
    v.push_back("wxyz");
    string temp;
    while(cin>>temp){
        cout<<getTime(temp)<<endl;
    }
}
// 64 位输出请用 printf("%lld")