#C12928. Find Anagrams
Find Anagrams
Find Anagrams
Given a target word and a list of candidate words, your task is to print all candidates that are anagrams of the target word. An anagram of a word is formed by rearranging its letters. The output should list each matching candidate on a separate line, in the same order as they appear in the input.
If no anagrams are found, the program should produce no output.
Note: The comparison is case-sensitive and even an empty string is considered a valid candidate if it is an anagram of the target word.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains a string representing the target word.
- The second line contains a non-negative integer n, which is the number of candidate words.
- The following n lines each contain a candidate word.
outputFormat
The program should output all candidate words that are anagrams of the target word, each on a separate line. If there are no anagrams, output nothing.
## samplelisten
4
enlist
google
inlets
banana
enlist
inlets
</p>