[WIP] Anagram: read words only once.

The first commit fixes #531, but I plan to improve the code a bit more.
I will refactor the code in the following commits.
Please add parenthesis in `split`, i.e., `for(split(//, $str))`--easier to read that way.