#!/usr/bin/perl

use strict;
use warnings;

sub repeated_substring {
    my $string = shift;

    my ($i, $l) = (0, 1);
    my $longest = "";
    my $len = length($string);
    while ($i+$l < $len) {
        my $search_str = substr($string, $i, $l);
        if (index($string, $search_str, $i+$l) < 0) {
            $i++;
            next;
        }
        if (length($search_str) > length($longest)) {
            $longest = $search_str;
        }
        $l++;
    }
    return $longest;
}

$/ = undef;
my $str = <STDIN>;

print "<" . repeated_substring($str) . ">\n";
