Back to General discussions forum
The problem statement says to count the number of words occurring in the dictionary list for a given word. In the example it says that the word "lots" should have 2 words associated with it however I see four words.
Not quite sure how to solve this one if the results in the problem check are not accurate...
This problem is about anagrams; the same letters, but in a different order.
The two anagrams of "lots" are "slot" and "lots"
ah ok thank you I appreciate the clarification.
Sorry, that should have said, the two anagrams of "lots" are "slot" and "lost".
For this example hearsed headers hearsed headers adheres adheres sheared sheared I am getting 7 anagrams but the answer is saying 3. In this I first permutated all the possiblities of hearsed and then compared it to the list we have.
Your 7 contains duplicates and the original word.
Hello, World!
I wrote a program to search for anagrams, but the result does not pass validation.
Expected answer was: 4 5 3 3 3 4 3 4 3 My program answer was: 8 5 3 8 3 4 4 4 3
The input data is as follows: 9 spriest parsed editors parries tasking sering altered salted scanter
My program found such words in the dictionary. They really exist: ['persist', 'priests', 'respite', 'sprites', 'stripes', 'tippers', 'tipsier', 'tipster'] ['drapes', 'padres', 'rasped', 'spared', 'spread'] ['sortied', 'steroid', 'storied'] ['apprise', 'aspires', 'praises', 'rapiers', 'raspier', 'repairs', 'sappier', 'spireas'] ['skating', 'staking', 'takings'] ['reigns', 'resign', 'signer', 'singer'] ['alerted', 'rattled', 'related', 'treadle'] ['deltas', 'lasted', 'slated', 'staled'] ['canters', 'recants', 'trances']
And this happens in all cases when the program is launched. What am I doing wrong?
tippers, respite, tipsier and tipster aren't anagrams of spriest
Thank you. From now on I will be attentive