From: Ken Bloom Date: 2008-01-19T05:40:00+09:00 Subject: Re: [QUIZ] Longest Repeated Substring (#153) On Fri, 18 Jan 2008 08:23:40 -0500, Ruby Quiz wrote: > The three rules of Ruby Quiz: > > 1. Please do not post any solutions or spoiler discussion for this quiz > until 48 hours have passed from the time on this message. > > 2. Support Ruby Quiz by submitting ideas as often as you can: > > http://www.rubyquiz.com/ > > 3. Enjoy! > > Suggestion: A [QUIZ] in the subject of emails about the problem helps > everyone on Ruby Talk follow the discussion. Please reply to the > original quiz message, if you can. > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- =-=-=-=-= > > This week's Ruby Quiz is to write a script that finds the longest > repeated substring in a given text. > > Your program will be passed some text on STDIN and is expected to print > the longest repeated substring within that text to STDOUT. > > Repeated substrings may not overlap. If more than one substring is > repeated with the same length, you may print any of them. If there is > no repeated substring, the result is an empty string (print nothing). > > Example: > > $ echo banana | ruby longest_repeated_substring.rb an > > OR > > $ echo banana | ruby longest_repeated_substring.rb na > > Make sure your code runs efficiently when passed a large text. First testcase: "your banana my banana" should give " banana" --Ken -- Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/