Longest Repeated Substring FIXED by test

#!ruby -pl
s=""
(~/$/).times{|a|a.upto(~/$/-1){|b|
  t=$_[a..b]
  $_.index(t) != $_.rindex(t) ? t.size > s.size && s=t : break
}}
$_=s

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top