InstaWP Interview Question

Write a program to collect duplicates in a string.