An exercise taken from the Ruby Quiz: Solitaire Cypher