#K88447. Anagram Group Finder
Anagram Group Finder
Anagram Group Finder
Given a list of strings, your task is to identify and output all groups of anagrams. Two strings are anagrams if one is a rearrangement of the other. Only groups containing at least two strings should be output. The order of the groups and the order of strings within each group does not matter.
Note: The grouping is case-sensitive. For instance, "Listen" and "silent" are not considered anagrams because of the uppercase 'L'.
Hint: A common approach is to sort the characters of each string and use the sorted result as a key.
inputFormat
The first line contains an integer n representing the number of strings. The following n lines each contain a single string.
For example:
8 listen silent enlist google goleog cat act tac
outputFormat
For each group of anagrams (with at least 2 strings), output a single line with the strings in that group separated by a space. If there are no anagram groups, output nothing.
## sample8
listen
silent
enlist
google
goleog
cat
act
tac
cat act tac
google goleog
listen silent enlist
</p>