An anagram of a word or phrase is another word or phrase that contains exactly the same letters. For instance "evil" is an anagram of "vile", "cheater" is an anagram of "teacher", and "New York times" is an anagram of "Monkeys write".
A pseudo-anagram of a word or phrase is another word or phrase that contains the same letters regardless of the number of times each letter appears. For instance, "teacher" is a pseudo-anagram of "reattach", "go" is a pseudo-anagram of "goo", and "drapes" is a pseudo-anagram of "desappeared". Obviously, any anagram is also a pseudo-anagram.
Write a program that reads a text and lists all the pairs of pseudo-anagrams it contains. Each pair must list the alphabetically smaller word first. The list of pairs must be sorted alphabetically by the first word of the pair.
Input
The input is a text consisting only of words in lowercase and whitespaces.
Output
The output is the list of pseudo-anagram pairs, alphabetically sorted. The pairs must be written with the alphabetically smaller word first.
Input
an anagram of a word or phrase is another word or phrase that contains exactly the same letters for instance evil is an anagram of vile and cheater is an anagram of teacher
Output
cheater teacher evil vile
Input
some mooses point to a sphera of phrases in grooming the hethett morning despite those semoses teppidest shoes and hoses
Output
despite teppidest grooming morning hethett the hoses shoes mooses semoses mooses some phrases sphera semoses some