Repeat characters from a sequence

I wrote this code that prints the characters that repeat when the user types a sequnce of characters that ends with '.'.
The program works just fine but for example if I type abaa it prints 'a' 3 times because character 'a' appears 3 times in the entered sequence.
What I would like the program to do is to print only ONE TIME all characters that appear more than once in the sequence.
Here's the code I wrote: