#include <iostream>
#include <cstring>
#include <string>
#include <functional>
#include <climits>
#define quickio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define endl "\n"
using namespace std;
typedef long long ll;
string board[8] = { "abc", "def", "ghi", "jkl", "mno", "pqrs","tuv", "wxyz"};
void solve()
{
string s;
getline(cin, s);
int sz = s.size();
int ans = 0;
for (int i = 0; i < sz; i++)
{
if (s[i] == ' ')
ans++;
else if (s[i] == 's' || s[i] == 'z')
{
ans += 4;
}
else
{
int x = (s[i] - 'a') / 3;
int j = 0;
ans++;
while (board[x][j] != s[i])
{
ans++;
j++;
if (j == 3)
{
j = 0;
if (x == 7)
x--;
else
x++;
ans -= 3;
}
}
}
}
cout << ans << endl;
}
int main()
{
solve();
return 0;
}