String remove duplicate problem only one testcase passing

code link-https://ide.codingblocks.com/s/107206
whats the prob ??

@Ajaypandey
Your code fails for testcases where the repetitions are more than two .
Input :
abcdeeeeeeffghiiiii

Expected output :
abcdefghi

Your Output :
abcdeeefghiii

1 Like

one test case is still failing , i included a for loop outside to iterate more no of times .
code link-https://ide.codingblocks.com/s/107223

@Ajaypandey
Don’t go with this method. Instead make a small change in your previous code. In the if statement where you have written n-- , write i-- after that. Inside the if block only.
Try running this and dry run a sample testcase to understand how this works.
Let me know if you are facing any trouble with it.

thank you . i got it