#include <bits/stdc++.h>
using namespace std;
char a[10005];
int f[26][26][5005], n;
int main() {
  scanf("%s", a + 1);
  n = strlen(a + 1);
  for (int i = n + 1; i <= n + n; i++) a[i] = a[i - n];
  for (int i = 1; i <= n; i++) {
    for (int p = i + 1; p < i + n; p++) {
      f[a[i] - 'a'][a[p] - 'a'][p - i + 1]++;
    }
  }
  int tot = 0;
  for (int i = 0; i < 26; i++) {
    int mx = 0;
    for (int p = 1; p <= n; p++) {
      int sum = 0;
      for (int j = 0; j < 26; j++) {
        if (f[i][j][p] == 1) sum++;
      }
      mx = max(mx, sum);
    }
    tot += mx;
  }
  printf("%.10lf", double(tot) / n);
  return 0;
}
