DEV Community

Bruce Axtens
Bruce Axtens

Posted on • Updated on

RosettaCode - see how other programmers do it

I've been hanging out a RosettaCode for years and have completed many of the challenges in many languages. I've even created some challenges.

Today I created a draft task. I've described this way:

On a set of coasters we have, there's a picture of a teacup. On the rim of the teacup the word "TEA" appears a number of times separated by bullet characters. It occurred to me that if the bullet were removed and the words run together, you could start at any letter and still end up with a meaningful three-letter word. So start at the "T" and read "TEA". Start at the "E" and read "EAT", or start at the "A" and read "ATE".

That got me thinking that maybe there are other words that could be used rather that "TEA". And that's just English. What about Italian or Greek or ... um ... Telugu.

So here's the task: from a web accessible or locally accessible word source, iterate through each word of length 3 or more. With each word, peel off the first letter and put it at the end. Check if the word exists. If it does, keep going with the next letter, repeating the process for as many letters as there are minus one. If all of the words exist store the original word. List the words that survive the process at the end. Optionally list all their variants.

I invite you to respond to the task (and any of the others on the site) in your language. If that language is already represented, present a better solution. And if your language isn't represented, add it! I just added Lychen.

By the way, being a draft task, the requirements are fluid and may change over time. You have been warned!

Top comments (0)