Anagram
InterviewTime limit4sMemory limit256 MB
Given a list of lowercase words, print each word whose anagram has not appeared earlier in the list, keeping the input order.
Statement
Two words are anagrams if the letters of the first word can be reordered to obtain the second one. An instance of anagrams is the pair "listen" and "silent".
Task
You are given a list of words, each word consisting of lowercase letters. Your goal is to filter this list by dropping any word whose anagram has already appeared earlier on the list.
Input
The first line contains , the length of the list. This is followed by lines, each containing one word.
Output
Print out the list of words without anagrams, one word per line. The words should appear in the same order as given in the input.
Constraints
- All letters are lowercase letters of the English alphabet.
- Length of any word will not exceed .