#C5526. Avoiding Consecutive Duplicates
Avoiding Consecutive Duplicates
Avoiding Consecutive Duplicates
Given a string s consisting of lowercase English letters, your task is to determine the minimum number of operations required so that no two adjacent characters are identical.
In one operation, you can change any single character to any other lowercase English letter. Formally, if the string has length n, you need to compute:
$$ \text{operations} = \sum_{i=1}^{n-1} \mathbb{1}(s_i = s_{i+1}) $$
where \( \mathbb{1}(\cdot) \) is the indicator function which is 1 if the condition is true, and 0 otherwise.
The input consists of multiple test cases. For each test case, output the minimum number of operations required on a new line.
inputFormat
The first line contains a single integer T (1 ≤ T ≤ 105) representing the number of test cases.
Each of the next T lines contains a non-empty string s composed of lowercase English letters. The length of each string is at least 1 and can be large.
outputFormat
For each test case, print a single integer on a new line: the minimum number of operations required to ensure that no two consecutive characters are the same.
## sample1
abcde
0
</p>