#P13419. [COCI 2012/2013 #6] BAKA
[COCI 2012/2013 #6] BAKA
题目描述
Mirko's grandma still uses an ancient pulse dial telephone with a rotary dial as shown in the following picture:
For each digit that we want to dial, we need to turn the rotary dial clockwise until the chosen digit reaches the finger stop (metal fin). Then we let go of the dial and wait for it to return to its original position before we can dial another digit. In our modern, instant gratification world, the dial return often lasts much longer than our patience. More precisely, dialling the digit takes a total of two seconds, while dialling any larger digit takes an additional second for each additional finger circle counting from to the dialled digit (as shown in the picture).
Mirko's grandma remembers phone numbers by memorizing a corresponding word which, when dialled, results in the correct number being dialled. When dialling a word, for each letter, we dial the digit which has that letter written next to it on the dial (for example, the digit for the letter S). For example, the word UNUCIC corresponds to the number . Your task is determining, for a given word, the total time required to dial that word.
: 'Little grandson' in Croatian.
输入格式
The first and only line of input contains a single word consisting of between and (inclusive) uppercase English letters.
输出格式
The first and only line of output must contain the required dialling time.
WA
13
UNUCIC
36
提示
Clarification of the first example: The corresponding phone number is , which needs seconds to dial.