#!/usr/bin/perl

@car = ('a'..'z','á', 'é', 'í', 'ó', 'ú', 'à', 'è', 'ã', 'õ', 'ä', 'ë', 'ï', 'ö', 'ü', 'å', 'ß', 'ç', 'ñ', 'ý', 'æ', 'ø', 'â', 'ê', ' î', 'ô', 'û' ) ;

for $a (@car) { for $b (@car) { $c{$a.$b}=0; } }


undef $/ ;

while(<>){
	$_=lc($_);
	for $p (keys %c){
		s/$p/conta($&)/gei;
	}
}

for $p (sort keys %c){
        $perc{$p}=100*$c{$p}/$totalP;
	print "$c{$p} $p \n" if $perc{$p}>=1.8;
        print "   -  $perc{$p}%\n" if $perc{$p}>=1.8;
}

print "\n TOTAL de pares de letras -> $totalP\n";

sub conta{
	my $p = shift;
	$c{$p}++;
	$totalP++;
	$p;
}



