def ic(ctext):
counts = ngram_count(ctext,N=<NUM_LIT:1>)<EOL>icval = <NUM_LIT:0><EOL>for k in counts.keys():<EOL><INDENT>icval += counts[k]*(counts[k]-<NUM_LIT:1>)<EOL><DEDENT>icval /= (len(ctext)*(len(ctext)-<NUM_LIT:1>))<EOL>return icval<EOL>
takes ciphertext, calculates index of coincidence.