Digital transformation has become a major revolution globally, not only a national strategy, but also a vital strategy for the Army. Mobile phones have become an indispensable part of modern life, especially for digital transformation. In addition to calling, mobile phones can be used to send text messages (SMS). However, in the military environment, the use of smartphones is not allowed, only classic phones (brick) are allowed, with this type of phone, the keys are very limited. To be able to type all the characters in the alphabet (No accents), many characters will be displayed on the same key. Therefore, to type a number of characters, a key must be pressed continuously until the character you want to find is displayed on the screen.
For a paragraph of text, calculate the number of keystrokes to display that paragraph on the screen.
The problem assumes that the keys are arranged as follows:
abc | def | |
ghi | jkl | mno |
pqrs | tuv | wxyz |
<SP> |
In the table above, each cell represents a key, <SP> represents the spacebar key. To display the character 'a', we have to press the corresponding key once, but to display the character 'b', we will have to press it twice, the character 'c' is 3 times... To create a space, we only need to press the <SP> key once.
Input: From the standard device has the following format:
- The first line is an integer T, which is the number of testcases.
- The next T lines, each line contains a character string S (including only lowercase characters and blank characters). The length of the character string is determined (1 ≤ |S| ≤ ~10^4~).
Output: Output to the standard device, each testcase corresponds to a line of results in the output. Each line starts with the testcase order, followed by the number of keystrokes for the corresponding text.
Exam:
Input
2 welcome to icpc telecommunication good luck and have fun for your result
Output
Case # 1: 68
Case # 2: 79
Comments