From a given string removing of duplicate characters

here why sir has not taken the condition for a[prev]==a[current];
explain it