Night at the Museum

题意翻译

## 题目描述 Grigoriy像某一喜剧电影中的英雄一样(我也不知道哪一部)晚上在博物馆里当保安。第一天晚上他收到了一个标签打印机。他要去给展馆里的文物一个个贴标签了。 这个标签打印机可以打印一张塑料标签。它打印的标签上的字母一个连着一个。打印机上有一个小写英文字母环,一个指向选中字母的指针和一个选中字母的按钮。字母环一个字母为一个,你想怎么转就怎么转,顺逆皆可。下面那张图为指针和字母环排列顺序。指针开始指向“a”。 Grigoriy添加一样新展品时需要打印出它的名字贴在上面。打完一个字母后不需要返回到字母“a”。 我们的英雄现在有点慌了。他感觉有些展品活过来了而且要锤他,所以他想赶快把名字打完回家。帮他找到打印字符串时字母环最少转动多少格。 ## 输入输出格式 ##### 输入格式 一行一个不超过一百个字符的字符串,均为小写英文字母,无空格。 ##### 输出格式 一个正整数:字母环最小转动的各数 ## 说明 1.从‘a’到‘z’(逆时针1格) 2.从‘z’到‘e’(顺时针5格) 3.从‘e’到‘u’(逆时针10格) 4.从‘u’到‘s’(逆时针2格)

题目描述

Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition. Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF731A/e954f3ab82d6a1e43e011d510d76e569c0046b9a.png)After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'. Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.

输入输出格式

输入格式


The only line of input contains the name of some exhibit — the non-empty string consisting of no more than $ 100 $ characters. It's guaranteed that the string consists of only lowercase English letters.

输出格式


Print one integer — the minimum number of rotations of the wheel, required to print the name given in the input.

输入输出样例

输入样例 #1

zeus

输出样例 #1

18

输入样例 #2

map

输出样例 #2

35

输入样例 #3

ares

输出样例 #3

34

说明

![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF731A/b4ad8bdb5f709d750195b10eaa0c48fb97965ceb.png)To print the string from the first sample it would be optimal to perform the following sequence of rotations: 1. from 'a' to 'z' ( $ 1 $ rotation counterclockwise), 2. from 'z' to 'e' ( $ 5 $ clockwise rotations), 3. from 'e' to 'u' ( $ 10 $ rotations counterclockwise), 4. from 'u' to 's' ( $ 2 $ counterclockwise rotations). In total, $ 1+5+10+2=18 $ rotations are required.