Codex M1 palindrome puzzle solution in Ruby