#include <bits/stdc++.h>
char s[(5010)];
int f[(5010)], cnt[(5010)], p[(5010)], v[200][(5010)], tot[200];
int main() {
  scanf("%s", s);
  int n = strlen(s), ans = 0;
  for (int i = 0; i < n; ++i) {
    v[s[i]][tot[s[i]]++] = i;
  }
  for (char c = 'a'; c <= 'z'; ++c) {
    int *p = v[c], mx = 0;
    for (int i = 0; i < tot[c]; ++i) f[i] = 0;
    for (int i = 0; i < n; ++i) {
      for (char t = 'a'; t <= 'z'; ++t) {
        cnt[t] = 0;
      }
      for (int j = 0; j < tot[c]; ++j) {
        cnt[s[p[j]]]++;
      }
      int q = 0;
      for (int j = 0; j < tot[c]; ++j) {
        q += cnt[s[p[j]]] == 1;
      }
      if (q > mx) mx = q;
      for (int j = 0; j < tot[c]; ++j) {
        p[j] = p[j] == n - 1 ? 0 : p[j] + 1;
      }
    }
    ans += mx;
  }
  printf("%0.15f\n", 1.0 * ans / n);
}
