Cognizant interview question

To print the duplicate elements in a given string?