Company: Adobe
Difficulty: easy
For each word in a list, determine the minimum number of character replacements needed so that no two adjacent characters are the same . If any two adjacent characters in a string are equal, one of them must be changed. A replacement may substitute any lowercase English letter. Calculate the minimum number of substitutions required for each word. Input format The first line contains an integer n - the number of words. Each of the next n lines contains one word words[i] . Output format Print n lines. The i -th line is the minimum number of substitutions required for words[i] . Constraints 1 <= n <= 100 2 <= length of words[i] <= 10^5 Each character of words[i] is in the range ascii[a-z]. Example 1 Input: 5 ab aab abb abab abaaaba Output: 0 1 1 0 1 Explanation: ab is already acceptable, so 0 replacements are needed. aab : replace one a with an appropriate character, so 1 replacement. abb : replace a b with an appropriate character, again 1 replacement. abab is already accepta