This is a practice problem for an upcoming contest…i cant figure out a case where my code fails to produce the correct output…can ne1 pls point out the mistake…thanks in advance…
ANAGRAM Given an English text print out the list of words and their anagrams in their order of occurrence. Word A is an anagram of word B if it can be derived from word B by merely shuffling the letters in word B. Important Points: Text can contain words in upper case as well as lower case and punctuation marks Anagrams are not to be case sensitive The word and its anagrams are to be printed in the order of their occurrence in the text, separated by a blank. If a word has no anagram in the text, then do not print it If a word or its anagram occurs more than once do not print it again Numbers are to be considered as valid words Input: A text containing K English words (where K <= 5000), with spaces and punctuation marks Output: The output should contain the word (in its order of occurrence in the text) and its set of anagrams in the text (again in their order of occurrence), separated by blanks Each new list of words and anagrams should begin on a new line All words in the output should be printed in lower case characters
Parts of the world have sunlight for close to 24 hours during summer. Dan went to the north pole to lead an expedition during summer. He had a strap on his head to identify himself as the leader. Dan had to deal with the sun never going down for 42 consecutive days and his leadership strap soon became a blindfold. He wondered what kind of traps lay ahead of him.
parts strap traps 24 42 dan and lead deal