Adding solution to remove string duplicates problem