cswork / OAOpen practice workspace

IBMOA #39

Get Minimum Operation Count

Estimated MediumJudge-ready

Topics (AI-labelled)GreedyStrings

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.

Input

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

Output

Output one integer, the answer.

Example 1

Input:

abdde

Output:

2

Example 2

Input:

ab

Output:

1

Example 3

Input:

az

Output:

0

Example notes

The examples give 2, 1 and 0 respectively.

Editorial

Loading solution…