cswork / OA打开练习工作台

IBMOA #39

Get Minimum Operation Count

估计中等可在线判题

考点(AI 标注)贪心调度字符串

Replace as few characters as possible so that any two adjacent characters are neither equal nor adjacent letters in the alphabet. Use only lowercase a to z; a and z are not adjacent.

输入格式

One line containing a lowercase string, 2≤length≤100000.

输出格式

Output one integer, the answer.

样例 1

输入:

abdde

输出:

2

样例 2

输入:

ab

输出:

1

样例 3

输入:

az

输出:

0

样例说明

The examples give 2, 1 and 0 respectively.