2007-03-15

Analiza x-gramâ

#!/usr/bin/perl -w
@q=undef$/;
($sifrat=<>)=~s/\W//g;
print"$sifrat\n";
sub analyze($){
undef%f;
$f{$_}=scalar(@q=$sifrat=~/$_/g)
for 'A'x$_[0]..'Z'x$_[0];
$f{$_} and print"$_: $f{$_}\t"
for sort{$f{$b}<=>$f{$a}||$a cmp $b}keys%f;
print"\n"
}
analyze $_ for 1..3;
__DATA__
VIWIV IPDQF ...cyphertext deleted to protect the lazy... ;-)

Nema komentara:

Objavi komentar