#!/usr/bin/perl
use locale;
use POSIX qw(locale_h);
setlocale(LC_CTYPE, "pt_PT") or die;

@sistema=("Jspell2","LabEL_DC", "ReGra", "LabEL_DL", "Smorph", "PALMORF");
$min=800000;
$max=1;
$i=0;
while ($i lt 6) {

    $j=$i+1;
    while ($j lt 6) {
	$k=$j+1;
	while ($k lt 6) {
	    $l=$k+1;
	    while ($l lt 6) {
		$res=`concord.pl $sistema[$i] $sistema[$j] $sistema[$k] $sistema[$l]`;
		($comuns)=($res=~/Formas comuns([0-9]+)/);
		print " $sistema[$i] $sistema[$j] $sistema[$k] $sistema[$l] $comuns\n";
		$min=$comuns if ($comuns le $min);
		$max=$comuns if ($comuns gt $max);
		$l++;
	    }
	    $k++;
	}
	$j++;
    }
    $i++;
}
print "Max: $max\n;Min: $min\n";
