#K39722. Remove Duplicate Characters

    ID: 26484 Type: Default 1000ms 256MiB

Remove Duplicate Characters

Remove Duplicate Characters

Given a string S, remove all duplicate characters while keeping only the first occurrence of each character. In other words, process the string from left to right and for every character, if it has not appeared before in the string then it should be included in the output, otherwise skip it.

More formally, let \(S = s_1 s_2 \cdots s_n\). You are required to construct a string \(T\) such that each character in \(T\) appears only once and in the same order as in \(S\). For example, if \(S = \texttt{programming}\), then \(T = \texttt{progamin}\).

inputFormat

A single line containing the string (S). The string can consist of letters, digits, and other characters.

outputFormat

Output a single line which is the string (S) after removing duplicate characters while keeping the first occurrence.## sample

programming
progamin