#C10540. Find Duplicate Characters

    ID: 39757 Type: Default 1000ms 256MiB

Find Duplicate Characters

Find Duplicate Characters

Given a string s, your task is to find all characters that occur more than once and output them in the order of their first appearance in the string. For example, if s = "programming", then the duplicate characters are r, g, and m (in that order).

Note: If there are no duplicate characters, print an empty line.

The formula for this problem can be conceptually represented as follows:

Let \( f(x) = \begin{cases} 1, & \text{if character } x \text{ appears more than once in } s, \\ 0, & \text{otherwise} \end{cases} \)

You need to output all characters \( x \) where \( f(x)=1 \) in the order in which they first appear in \( s \).

inputFormat

The input consists of a single line containing a non-empty string s composed of printable characters.

outputFormat

Output the duplicate characters separated by a single space in one line. If there are no duplicate characters, output an empty line.

## sample
programming
r g m