use v5.10;
sub longest_rep{
$_[0] =~ /(?=(.+)\1)(?!(??{ '.+?(..{' . length($^N) . ',})\1' }))/;
}
say longest_rep '01011010';
say longest_rep '010110101000110001';
say longest_rep '2323191919191919';
say longest_rep '22010110100';
dXNlIHY1LjEwOwoKc3ViIGxvbmdlc3RfcmVwewogICAgJF9bMF0gPX4gLyg/PSguKylcMSkoPyEoPz97ICcuKz8oLi57JyAuIGxlbmd0aCgkXk4pIC4gJyx9KVwxJyB9KSkvOwp9CgpzYXkgbG9uZ2VzdF9yZXAgJzAxMDExMDEwJzsKc2F5IGxvbmdlc3RfcmVwICcwMTAxMTAxMDEwMDAxMTAwMDEnOwpzYXkgbG9uZ2VzdF9yZXAgJzIzMjMxOTE5MTkxOTE5MTknOwpzYXkgbG9uZ2VzdF9yZXAgJzIyMDEwMTEwMTAwJzs=