#K71182. Remove Duplicate Characters

    ID: 33475 Type: Default 1000ms 256MiB

Remove Duplicate Characters

Remove Duplicate Characters

Given a string s, remove all duplicate characters so that each character appears only once. The order of characters in the output should correspond to their first appearance in the input.

For example:

  • If s = "banana", the output should be ban.
  • If s = "apple", the output should be aple.
  • If s = "racecar", the output should be race.

Solve the problem using standard input and output.

inputFormat

The input is provided as a single line from standard input containing the string s.

outputFormat

Output the resulting string after removing duplicate characters, preserving the original order of their first occurrences. The result should be printed to standard output.## sample

banana
ban