func entropy s$ . len d[] 255 for c$ in strchars s$ d[strcode c$] += 1 . for cnt in d[] if cnt > 0 prop = cnt / len s$ entr -= (prop * logn prop / logn 2) . . return entr . print entropy "1223334444"