Puzzlenode problem #11, solved using Ruby