#!/usr/bin/perl -w

use strict;

sub compare_strings {
	my @strings = @_;

	my %dictionary = ();

	my $L = @$strings;
	for (my $I=0; $I<$L; ++$I) {
		my $s = \$strings[$I];
		my $l = length $$s;
		
		for (my $i=0; $i<$l; ++$i) {
			my $sl = 1;
			my $substr = "";
			my $i1 = $i;
			for (my $i1=$i; $i1 < $l; ++$i1) {
				my $char = substr $$s, $i1, 1;
				$substr .= $char;
				if (! $dictionary{$substr}) {
					push @{$dictionary{substr $substr, 0, -1}}, [$I, $i];
					last;
				} else {
					$substr .= $char;
				}
			}

$substr += $charsubstr ($i
		}
	}
