#include <bits/stdc++.h>
using namespace std;
const int N = 5E3 + 5;
struct Point {
  int len, c[N];
} s[N];
int num[N][27], n;
bool cmp(Point a, Point b) { return a.c[1] < b.c[1]; }
int main() {
  char c = getchar();
  while ('a' <= c && c <= 'z') {
    s[1].c[++s[1].len] = c - 'a' + 1;
    c = getchar();
  }
  n = s[1].len;
  for (int i = 2; i <= n; i++) {
    s[i].len = s[i - 1].len;
    for (int j = 2; j <= n; j++) s[i].c[j] = s[i - 1].c[j - 1];
    s[i].c[1] = s[i - 1].c[n];
  }
  sort(s + 1, s + n + 1, cmp);
  int sum = 0, tot = -1;
  for (int i = 1; i <= n + 1; i++) {
    if (s[i].c[1] != s[i - 1].c[1]) {
      int Max = 0;
      tot++;
      for (int j = 2; j <= n; j++) {
        int cnt = 0;
        for (int k = 1; k <= 26; k++) {
          if (num[j][k] == 1) {
            cnt++;
          }
        }
        Max = max(Max, cnt);
      }
      sum += Max;
      memset(num, 0, sizeof(num));
    }
    for (int j = 2; j <= n; j++) num[j][s[i].c[j]]++;
  }
  printf("%.9lf\n", double(sum) / double(n));
  return 0;
}
