How to remove the duplicates?

how to remove the duplicate substes?

You can see this code as an example https://ide.codingblocks.com/s/354167

can you explain your approach a little