#C6196. Find Anagrams
Find Anagrams
Find Anagrams
Given a string \( s \) and a list of words, determine all words that are anagrams of \( s \). A word is an anagram of \( s \) if, after converting both to lowercase, the sorted sequence of characters in the word is equal to that of \( s \). For example, if \( s = \text{'listen'} \) and the list is ["enlist", "google", "inlets", "banana", "silent"], then the valid anagrams are "enlist", "inlets", and "silent".
You must read the input from stdin and write the output to stdout. The format details are provided below.
inputFormat
The input consists of multiple lines:
1. The first line contains the string \( s \).
2. The second line contains an integer \( n \) denoting the number of words.
3. Each of the following \( n \) lines contains one word from the list.
outputFormat
Output a single line containing all the words from the list which are anagrams of \( s \) (in their original order), separated by a single space. If there are no anagrams, output an empty line.
## samplelisten
5
enlist
google
inlets
banana
silent
enlist inlets silent
</p>