#K7141. Find Anagrams

    ID: 33525 Type: Default 1000ms 256MiB

Find Anagrams

Find Anagrams

You are given a list of words and a target word. Your task is to find all the words from the list that are anagrams of the target word.

An anagram of a word is formed by rearranging its letters; formally, two words are anagrams if, when sorted, they result in the same sequence of characters, i.e. if $$sorted(word) = sorted(target)$$.

Note: The comparison is case-sensitive. For example, if the target word is tinsel, then Listen is not considered an anagram because L and l are different.

inputFormat

The input is read from standard input.

The first line contains an integer $$N$$ representing the number of words.
The next $$N$$ lines each contain a single word.
The last line contains the target word.

outputFormat

Print each anagram that is found in the list on a separate line. If there are no anagrams, do not print anything.## sample

5
listen
silent
enlist
google
golem
tinsel
listen

silent enlist

</p>