#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;
      e += -t * log(t) / log(2.0);
    }
  printf("entroy: %f bits\n", e);
  return 0;
}
/* end */
