I Love You, Yonsei
Time limit1.885sMemory limit1024 MB
- Level
Not classified yet
- Solved
- No attempts yet
Problem
Do you love Yonsei?
The cheer song that Yonsei people love most,
I love you, Yonsei, Yonsei, I love you...
Statement
Hun-gyu, a Korea University student, cheered hard at the 2022 regular Yeongo match and lost consciousness. When he woke up, he was locked in a prison at Yonsei University. To escape, he must use the password tiles on the floor to enter the password ILOVEYONSEI.
The password tiles are 26 kinds of tiles laid out in a row. Each tile has an uppercase letter, and the letters go from left to right in alphabetical order. That is, the i-th tile has the i-th uppercase letter. Adjacent tiles are 1 apart. So to get from the tile with A to the tile with Z, you must move a distance of 25. To enter a letter, you must step onto the tile with that letter and jump. A jump moves a distance of 0.
The letter on the tile where Hun-gyu is currently standing is given. Hun-gyu wants to enter the whole password with the minimum movement distance.
Input
The input is given as follows.
Output
Print the minimum total movement distance Hun-gyu needs to enter the entire password.
Constraints
is an uppercase letter from A to Z.