Removing duplicate characters from string

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