String Reductions | HackerRank

Given a string, , consisting of lowercase English characters (), remove all of the characters that occurred previously in the string. Formally, remove all characters, , for:

and

Input Format

A single line of input containing a string of length .

Output Format

Print the string after removing all the characters that occurred previously.

Sample Input #00

accabb

Sample Output #00

acb

Sample Input #01

abc

Sample Output #01

abc

Sample Input #02

pprrqq

Sample Output #02

prq

Explanation

Test case #00: For , characters at indexes are removed as they have already occurred.
Test case #01: As each character occurs only once, nothing is removed.
Test case #02: For , each character occurs twice. The second of these characters is removed. Characters at positions and are removed.