Remove duplicates in string


I am not able to solve for the cases like abbaab.
please help

Solved this problem.