#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
int n;
char s[N];
int a[N], tot, p[N], f[26];
int main() {
  scanf("%s", s);
  n = strlen(s);
  double ans = 0;
  for (int i = 0; i != n; ++i) a[i] = s[i] - 'a';
  for (int ch = 0; ch != 26; ++ch) {
    memset(f, 0, sizeof(f));
    memset(p, 0, sizeof(p));
    tot = 0;
    for (int i = 0; i != n; ++i)
      if (a[i] == ch) p[++tot] = i, ++f[a[i]];
    int cnt = tot == 1, max = cnt;
    for (int i = 0; i != n; ++i) {
      for (int j = 1; j <= tot; ++j) {
        --f[a[p[j]]];
        if (!f[a[p[j]]]) --cnt;
        if (f[a[p[j]]] == 1) ++cnt;
        p[j] = p[j] + 1;
        if (p[j] == n) p[j] = 0;
        ++f[a[p[j]]];
        if (f[a[p[j]]] == 2) --cnt;
        if (f[a[p[j]]] == 1) ++cnt;
      }
      if (cnt > max) max = cnt;
    }
    ans += (double)max / n;
  }
  printf("%.12lf\n", ans);
}
