James Gray
1/20/2008 3:59:00 PM
Begin forwarded message:
> From: Yoan Blanc <yoan@dosimple.ch>
> Date: January 18, 2008 1:18:37 PM CST
> To: submission@rubyquiz.com
> Subject: Please Forward: Ruby Quiz Submission
>
> thanks.
> #!/usr/bin/ruby
> # author: Yoan Blanc <yoan at dosimple.ch>
> # revision: 20080118
>
> text = STDIN.read
>
> (text.length/2).downto 1 do |l|
> match = Regexp.new("(.{#{l}})\\1").match(text)
> if match
> puts text[match.offset(1)[0]..(match.offset(1)[1]-1)]
> break
> end
> end