#include <bits/stdc++.h>
using namespace std;

int alphabetTimes[] = {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 main()
{
    string s;
    while (cin >> s)
    {
        int TotalTime = alphabetTimes[s[0] - 'a'];
        for (int i = 1; i < s.size(); i++)
        {
            if (abs(s[i] - s[i - 1]) ==
                alphabetTimes[max(s[i], s[i - 1]) - 'a'] -
                    alphabetTimes[min(s[i], s[i - 1]) - 'a'])
                TotalTime += 2;
            TotalTime += alphabetTimes[s[i] - 'a'];
        }
        cout << TotalTime << endl;
    }
    return 0;
}