We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!Submit Feedback
This was actually quite some challenge.
I, as many others, did originally not the the same result, and I bluntly assume, that is because the approach and interpretation of, what does make a word, is is different.
E.g. I would not consider the word Gateway_ with an underscore to be a complete word of it's own, I would consider it similar toi Gateway with out the underscore. Never the less, these and many more are counted as different words in the solution.
So all though I do not concur with the provided result, once I tried to think, how that particular result was made, I actually was able to match the exact same output with this solution.
My assumption here was that the RegEx like (\w+) was used, I tried originally to use the "Whole Word" RegEx like \<\w+\>, but that yields a completely different outcome.
Watch out for trunc... <hint hint> Fixing the length helped me get the numbers in line with expectations. Some cleaning up after the mess I created helped match things up.
Tried both methods from file and download and got the same results.
I also managed to get close to, but not exactly the same as the provided solution.
I do see that the provided solution has a number of words with leading or trailing underscores which doesn't seem particularly desirable.