# Implementation

sub repeated_substring {
  my ($string,$result)=shift;
  while ($string=~/(.+)(?=.*?\1)/sg) {
    $result=$1 if length($1) > length($result);
  }
  return $result;
}

__END__
# Test Code
local $/;
$string=<>;
$start=localtime;
$result=repeated_string (substr($string,-2000));
print "result: '$result'\n";
print "start: $start\n end:  ",scalar
(localtime),"\n";

# I made a test on win32 PIII800, and the averege for
2k string is 3-4 seconds





__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
