Remove duplicates in a string

Remove duplicates in a string. Two versions. 1)Order matters and 2)
Order does not matter