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.
The input is a text consisting only of words in lowercase and whitespaces.
The output is the list of pseudo-anagram pairs, alphabetically sorted. The pairs must be written with the alphabetically smaller word first.
Author: Lluís Padró
Generation: 2026-01-25T14:54:03.057Z
© Jutge.org, 2006–2026.
https://jutge.org