#K38647. Extract Unique Digits

    ID: 26245 Type: Default 1000ms 256MiB

Extract Unique Digits

Extract Unique Digits

Given a string representing a sequence of digits, your task is to extract and print the unique digits in the order of their first occurrence.

For example, if the input is 1234321, the output should be 1234, because when scanning from left to right the first occurrences are: 1, 2, 3, and 4. Any subsequent duplicate digits are ignored.

Note: The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).

Examples:

  • Input: 1234321 → Output: 1234
  • Input: 9876543210 → Output: 9876543210
  • Input: 1212121212 → Output: 12

inputFormat

The input consists of a single line that contains a sequence of digits (0-9). The sequence may be empty.

outputFormat

Output a single line containing the unique digits extracted in the order they first appear in the input.

## sample
1234321
1234

</p>