In the problem good string([https://mirror.codeforces.com/problemset/problem/1389/C]) I made two observations- i. When n is odd then all characters are equal ii. Else s1 = s3 = ... = sn s2 = s4 = ... = sn-1
It means the string is fixed by the first two starting characters. I iterated from 0 to 9 for the first two characters and found the count of positions- if i is odd and si != s1 or i is even and si != s2
My answer is off by one in some test cases. I want to a small test string where I could find the reason.