PalantirOA #3
No Pairs Allowed
EasyJudge-ready
You are given n words of lowercase English letters. In each word, any character may be replaced with any lowercase English letter. Find the minimum number of replacements so that the final string has no two equal adjacent characters.
Input
The first line contains n (1≤n≤100), followed by n lines each with one word; 2≤length of each word≤100000, and all characters are a–z.
Output
Output the minimum number of replacements for each word in input order, separated by spaces.
Example 1
Input:
3
add
boook
break
Output:
1 1 0
Example 2
Input:
2
aa
aaa
Output:
1 1
Example 3
Input:
2
ab
zzzz
Output:
0 2
Editorial
Loading solution…