#include <stdio.h>
#include <math.h>

#define N 128

int getword()
{
  int a = getchar();
  int b = getchar();
  if (b == -1) return -1;
  return a*N + b;
}

void main ()
{
  int i,l,n;
  int c,b,d;
  int count[N*N];
  int a[N*N];
  float p,e = 0;

  n = N*N;
  l = 0;

  for (i = 1; i < n; i++) {
    count[i] = 0;
    a[i] = i;
  }

  while ((c = getword()) != -1) {
    i = 0;
    b = a[i];
    while ((b != c) & (i < n)) {
      d = a[i+1];
      a[i+1] = b;
      b = d;
      i++;
    }
    a[0] = c;
    count[i] = count[i] + 1;
    l++;
  }


  for (i = 1; i < n; i++) {
    if (count[i] != 0) {
      p = ((float) count[i])/(float) l;
      e = e - p * log(p)/log(2);
    }
  }
  printf("%f\n", e/2.0);
}


