All submissions for this problem are available.
An anagram is a word or phrase formed by rearranging the letters of another word or
phrase. For example, “carthorse” is an anagram of “orchestra”. Blanks within a
phrase are ignored in forming anagrams. Thus, “orchestra” and “horse cart” are also
Write a program that read a list of phrases and prints all pairs of anagrams occurring
in the list.
The Input file will contain a single integer at the first line of the input, indicate the
number of test case you need to test followed by a blank line. Each test case will
consist of from 1 to 100 lines. A completely empty or blank line signals the end of a
test case. Each line constitutes one phrase.
Some number of lines (including possibly 0 if there are no anagrams in the list), each
line containing two anagrammatic phrases separated by ‘=’.
Each anagram pair should be printed exactly once, and the order of the two phrases
within a printed pair must be lexicographic, as well as the first phrases and the
second ones in case some first are equal.
Two consecutive outputs for two consecutive inputs is separated by a single blank
Input: 1 carthorse horse horse cart i do not know u ok i now donut orchestra Output: carthorse = horse cart carthorse = orchestra horse cart = orchestra i do not know you = ok i now donut
|Time Limit:||5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.