def keyborard(s):
    arr = [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]
    group = [1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,6,7,7,7,8,8,8,8]
    for i in range(9, 100):
        group.append(i)
    pre = '{'
    sum=0
    #print(chr(ord('z')+1))
    for i in s:
        if group[ord(i)-ord('a')] == group[ord(pre)-ord('a')]:
            sum+=2
        
        sum+=arr[ord(i)-ord('a')]
        pre = i
    print(sum)

while True:
    try:
        s = input()
        keyborard(s)
    except:
        break