import sys
def func(s):
    alphbet=['abc','def','ghi','jkl','mno','pqrs','tuv','wxyz']
    count=0
    pregroup=-1
    for i in s:
        for group in alphbet:
            if i in group:
                if alphbet.index(group)!=pregroup:
                    loc=group.index(i)
                    pregroup=alphbet.index(group)
                    press=loc+1
                    count+=press
                else:
                    count+=2
                    loc=group.index(i)
                    pregroup=alphbet.index(group)
                    press=loc+1
                    count+=press
    print(count)
for line in sys.stdin:
    func(line.strip('\n'))

双指针法记录前驱组的位置,判断是否要等待