Remove consecuitve duplicates using recursion ? mistake in my code?

@hg11110000
I have made slight changes to your code. have a look at it. Just added one little condition and it now works fine.