Please enter your email address or userHandle.
Ishaan is playing with strings these days. He has found a new string. He wants to modify it as per the following rules:
First line of input contains a single integer T denoting the number of test cases. The only line of each test case contains a string S consisting of lowercase English Alphabets.
For each test case, in a new line, print the minimum number of characters which Ishaan must insert in the string.
1 <= T <= 200
1 <= Length of S <= 103
3 b's occur consecutively, we add a 'd',
5 a's occur consecutively, we need to add 2 'b',
Testcase 3 :
No character occurs 3 times, so no need to add anything.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.