From: Ruby Quiz Date: 2008-01-18T22:23:40+09:00 Subject: [QUIZ] Longest Repeated Substring (#153) 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.