Strings-remove duplicates

Coding Blocks
above is my code. It is not giving correct output. Please tell what is wrong in it.