If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Thursday, December 15, 2011

NLP exercise: convert back a rotated String

This week we had a little assignment where we receive a text as input. But all letters in the text are rotated by some number. Our mission is to find out what the original text was.
Below follows a naive approach by just applying brute force and shifting all letters for a range of 1 to 25.

TextRotator trait:


The test script:


Output of running the NLPTest:


The solution can be found on lines 16.