On Dec 9, 2007, at 1:50 PM, Eric I. wrote: > Here is my solution that tries to make all possible arrangements and > displays solutions with the maximum number of overlaps. Here is the much-less-clever code used to create the quiz: #!/usr/bin/env ruby -wKU word = ARGV.first or abort "Usage: #{File.basename($PROGRAM_NAME)} WORD" if word.downcase =~ /([a-z]).(?:.{2})+\1/ before, during, after = word[0, $`.length], word[$`.length, $&.length], word[-$'.length, $'.length] indent = " " * before.length after.split("").reverse_each { |char| puts indent + char } puts before + during[0..1] ((during.length - 3) / 2).times do |i| puts indent + during[-(i + 2), 1] + during[2 + i, 1] end else puts "No loop." end __END__ James Edward Gray II