#K38667. Unique Characters Extraction

    ID: 26250 Type: Default 1000ms 256MiB

Unique Characters Extraction

Unique Characters Extraction

You are given a string S consisting of characters. Your task is to remove all duplicate characters while preserving the order of their first appearance. Formally, for each character in the string, if it has not appeared before, include it in the result; otherwise, skip it.

The removal process can be mathematically described as follows. For a string \( S = s_1s_2\ldots s_n \), construct a string \( R \) such that if \( s_i \) is the first occurrence of that character in \( S \), then \( s_i \) is appended to \( R \); otherwise, it is omitted.

Input is taken from stdin and output should be printed to stdout. Solve the problem using the most appropriate method to handle potentially large inputs efficiently.

inputFormat

The input consists of a single line containing the string S to process. The string can include letters, digits, and other characters.

outputFormat

Output the resulting string after removing duplicate characters (keeping only the first occurrence) to stdout.

## sample
bananas
bans