#C4132. Minimum Deletions for Alternating Characters

    ID: 47637 Type: Default 1000ms 256MiB

Minimum Deletions for Alternating Characters

Minimum Deletions for Alternating Characters

You are given a string s consisting of only the characters 'a' and 'b'. Your task is to determine the minimum number of deletions required to transform the string into a string that alternates between 'a' and 'b'. In an alternating string, no two adjacent characters are the same.

For example, consider the string "ababb". By deleting one character, you can obtain the alternating string "ababa", so the answer is 1.

Note: It is guaranteed that the string consists only of the characters 'a' and 'b'.

The challenge is to implement an efficient solution that works for long strings.

inputFormat

The input consists of a single line containing a string s composed only of the characters 'a' and 'b'.

outputFormat

Output a single integer, which is the minimum number of deletions required so that no two adjacent characters are equal.

## sample
ababb
1