#include <stdio.h>
#include <math.h>
#define N 26
static char *s = "asdfasdagsdfa";
int main() {
static int a[N];
int n, i;
double e, t;
char *p;
for (p = s, n = 0; *p; p++, n++)
a[*p - 'a']++;
e = 0.0;
for (i = 0; i < N; i++)
if (a[i]) {
t = (double)a[i] / n;
}
printf("entroy: %f bits\n", e
); return 0;
}
/* end */
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+CgojZGVmaW5lIE4gMjYKc3RhdGljIGNoYXIgKnMgPSAiYXNkZmFzZGFnc2RmYSI7CgppbnQgbWFpbigpIHsKICBzdGF0aWMgaW50IGFbTl07CiAgaW50IG4sIGk7CiAgZG91YmxlIGUsIHQ7CiAgY2hhciAqcDsKICBmb3IgKHAgPSBzLCBuID0gMDsgKnA7IHArKywgbisrKQogICAgYVsqcCAtICdhJ10rKzsKICBlID0gMC4wOwogIGZvciAoaSA9IDA7IGkgPCBOOyBpKyspCiAgICBpZiAoYVtpXSkgewogICAgICB0ID0gIChkb3VibGUpYVtpXSAvIG47CiAgICAgIGUgKz0gLXQgKiBsb2codCkgLyBsb2coMi4wKTsKICAgIH0KICBwcmludGYoImVudHJveTogJWYgYml0c1xuIiwgZSk7CiAgcmV0dXJuIDA7Cn0KLyogZW5kICovCg==