#!/usr/bin/perl

while (<>){
	$_=lc($_);
	s/\015//g;
	s/\./ /g; s/\,/ /g; s/\;/ /g; s/\:/ /g; 
	s/\!/ /g; s/\?/ /g;
	s/\(/ /g; s/\)/ /g;
	s/\^/ /g; s/\"/ /g; s/\// /g; s/\\/ /g;
	s/\*/ /g; s/\+/ /g; s/\- / /g; s/\ -/ /g; s/\=/ /g;
	s/\[/ /g; s/\]/ /g;
	s/\$/ /g; s/\#/ /g; s/\&/ /g; s/\%/ /g;
	s/\{/ /g; s/\}/ /g;
	s/\</ /g; s/\>/ /g;
	s/[0-9]/ /g; s/\'/ /g;
        chop;
        @pal = split(/ +/, $_);
        for $a (@pal){
	        trata($a) unless $a eq "";
        }
}


for $t (sort keys %c){
        $perc{$t}=100*$c{$t}/$totalP;
    	printf "%4d %3s - %7f\n", $c{$t}, $t,$perc{$t} if $perc{$t}>2; 
} 
print "\n Total de terminações -> $totalP\n\n";

sub trata{
        my $p = shift;
	my $t = substr($p,-3);
        $c{$t}++;
	$totalP++;
}

