Unique Strings

2.2

10 votes
Data Structures, Medium, Hash function
Problem

Given a word consisting of lowercase English letters, write a program to remove duplicates from the word. The characters in the output must preserve the same order, as their first appearance in the original word.

Input Format

The input consists of several test cases.
The first line of the input file contains a positive integer T, the number of test cases.
Then, T lines follow, each containing a single word W (no spaces, only lowercase English letters).

Output Format

The output must contain exactly T lines, each line containing a single word, the required answer.

Constraints

1 ≤ T ≤ 100
1 ≤ |W| ≤ 31

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?