#K63507. Remove Duplicate Characters
Remove Duplicate Characters
Remove Duplicate Characters
Given a string S, remove all duplicate characters while preserving the order of their first appearance. For example, if S is abbacccd
, then the output should be abcd
. Use the \(\text{removeDuplicates}\) logic to solve the problem.
The task is simple: iterate through the input string, and record each character the first time it appears. If a character has already been seen, skip it. Finally, output the result.
Note: The input will be provided via standard input (stdin) and the resulting string should be printed to standard output (stdout).
inputFormat
The input consists of a single line containing a string \(S\) which may include alphabets, digits, and symbols. The length of \(S\) can be up to \(10^5\) characters.
outputFormat
Output a single string that has all the duplicates removed from \(S\) and the original order preserved.
## sampleabbacccd
abcd