String removes dublicates

Why have you copied a[prev]=a[current]

so that the the position of prev the value of a[current] can be copied

eg
cooooding
suppose curr pointer is pointing to d
and prev would be at 1
then we need to add d to position 2
so that is why we are doing a[prev] = a[curr]
codooding will be made

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.