#C13279. Unique Non-Repeating Characters
Unique Non-Repeating Characters
Unique Non-Repeating Characters
Given a string of alphanumeric characters, your task is to generate a new string that consists only of the characters that appear exactly once in the original string. The order of characters must be maintained as in the original string.
For example:
- If the input is
abcde
, then the output should beabcde
because all characters are unique. - If the input is
swiss
, then the output should bewi
because 's' is repeated. - If the input is
aabbcc
, then the output should be an empty string since every character appears more than once. - If the input is an empty string, the output should also be an empty string.
- Case is significant, so for
aAbBcCdD
the result isaAbBcCdD
. - For numerical strings like
123324
, the answer is14
, since digits '2' and '3' are repeated.
</p>
Note: The solution should work for any string containing alphanumeric characters. In mathematical notation, if S is the set of characters in the string with frequency function \( f: S \to \mathbb{N} \), then the result is R = { c \in S : f(c)=1 } keeping the order of appearance.
inputFormat
The input consists of a single line that contains a string s
composed of alphanumeric characters.
outputFormat
Output the new string that contains only the characters that occur exactly once in s
, in the order of their first appearance.
abcde
abcde