2022 年上海市大学生程序设计竞赛 - 十二月赛

B. String

单点时限: 1.0 sec

内存限制: 256 MB

Given a string $S$ only contains lower-case Latin letters, you can perform the following operations on $S$ any number of times:

Select a non-empty contiguous substring of $S$ and replace the current character with its next character, specifically, when the current character is z, replace it with a.

For example: abcabc, choose the interval $[1,6]$ and the result of one operation is bcdbcd.

Your goal is to find the minimum number of operations required to make $S$ contains only one type of lower-case Latin letter.

Restriction: The number of operations on each position can not exceed 25.

输入格式

A string $S\ (|S|\le 10^5)$ as required.

输出格式

Output one number — the minimum number of operations required to make $S$ contains only one type of lower-case Latin letter.

样例

Input
abc
Output
2
Input
abz
Output
3