#P1765. Minimum Key Presses on a Mobile Keypad
Minimum Key Presses on a Mobile Keypad
Minimum Key Presses on a Mobile Keypad
A typical mobile phone keypad is arranged as follows:
- 2: a, b, c
- 3: d, e, f
- 4: g, h, i
- 5: j, k, l
- 6: m, n, o
- 7: p, q, r, s
- 8: t, u, v
- 9: w, x, y, z
- 0: space
To type a letter, you need to press the corresponding digit key a number of times equal to the position of the letter in that key. For example, to type the letter $\tt{x}$ which is on key $9$ with the order \(w, x, y, z\), you must press key $9$ twice (the first press outputs \(w\) and the second changes it to \(x\)).
Your task is to calculate the minimum number of key presses required to type a given sentence that contains only lowercase English letters and spaces.
inputFormat
The input consists of a single line containing a sentence. The sentence includes only lowercase English letters and spaces.
outputFormat
Output a single integer: the minimum number of key presses required to type the sentence on the mobile phone keypad.
sample
a
1