#C23. Find Anagrams
Find Anagrams
Find Anagrams
You are given a list of words. Your task is to identify and output all the words that have at least one anagram within the given list. Two words are anagrams if one can be obtained from the other by rearranging its letters exactly, using all the original letters exactly once. The order of the output should follow the order of words in the input.
Important: The input will be read from standard input (stdin) and the output should be written to standard output (stdout). There is a single test case per run.
For example, if the input list is:
10 listen silent enlist google gooegl cat act tac dog god
Then every word in the list has at least one other anagram in the list so all words are printed.
inputFormat
The first line contains an integer N representing the number of words. The second line contains N words separated by spaces.
outputFormat
Print the words that have at least one anagram in the list, maintaining their original order. Words should be printed in a single line separated by a single space. If no word has an anagram, output an empty line.
## sample10
listen silent enlist google gooegl cat act tac dog god
listen silent enlist google gooegl cat act tac dog god