sub repeated_substring {
	my $string = shift;
	for (my $length = int(length($string) / 2); $length; $length--) {
		for (my $i = 0; $i <= length($string) - 2 * $length; $i++) {
			return $1 if $string =~ /^.{$i}(.{$length}).*?\1/;
		}
	}
	return '';
}
