#!/usr/bin/perl

@car = ('a'..'z','á', 'é', 'í', 'ó', 'ú', 'à', 'è', 'ã', 'õ', 'ä', 'ë', 'ï', 'ö', 'ü', 'å', 'ß', 'ç', 'ñ', 'ý', 'æ', 'ø', 'â', 'ê', ' î', 'ô', 'û' ) ;
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}/$totalL;    
	print "$c{$p} $p " if $perc{$p}>5 ;
	print "   -  $perc{$p}%\n" if $perc{$p}>5 ;
}

print "\n TOTAL de letras -> $totalL\n";

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

