InstaWP interview question

Write a program to collect duplicates in a string.