Help needed in cf B problem

Problem link :- Problem - B - Codeforces
My solution :- Submission #123256191 - Codeforces

I am getting wrong ans on test case 8 which is very big , I am not able to find any left case in my code.

please help Thanks in advance

why do you think the middlemost character will be your answer ?

for example

I am not taking the middle most character of original string
I am taking the middle character of unique of original string

like for your test case aaabbbccba so we should take c and insert it at 3 possible places to remove the complete string

my s1(unique of s) will be abcba and then I am taking center of this which will be c

so my code will give ans as 3 for this test case

ok my bad

Check this

1 Like

Ohh yaa thank you so much

In this case the Ans should be 3 but I am getting 7