#!/usr/local/bin/perl
$skip=$ARGV[0] ; 
@text=<stdin> ; 
$all=join('',@text) ; 
$all =~ tr/a-z/A-Z/ ; 
$all =~ tr/A-Z//cd ; 
$header=substr($all,0,$skip) ; 
$shifted = substr($all,$skip).$header ; 
@alltxt=split(//,$all) ; 
@shiftxt=split(//,$shifted) ; 
foreach $i(0..$#alltxt){
    if($alltxt[$i] eq $shiftxt[$i]) { $count++ ;}
}
printf("Index of Coincidence is: %2f\n",$count/$#alltxt) ; 
