4969. 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

110 人解决,153 人已尝试。

114 份提交通过,共有 317 份提交。

3.5 EMB 奖励。

创建: 1 年,4 月前.

修改: 1 年,4 月前.

最后提交: 9 月前.

来源: N/A

题目标签