#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
char s[N];
int a[N][26][26];
int main() {
  scanf("%s", s);
  int i, j, k, n = strlen(s), ans = 0;
  for (i = 1; i < n; i++) {
    for (j = 0; j < n; j++) {
      int x = s[j] - 'a', y = s[(i + j) % n] - 'a';
      a[i][x][y]++;
    }
  }
  for (i = 0; i < 26; i++) {
    int zl = 0;
    for (j = 0; j < n; j++) {
      int x = 0;
      for (k = 0; k < 26; k++) {
        x += (a[j][i][k] == 1);
      }
      zl = max(zl, x);
    }
    ans += zl;
  }
  printf("%.10lf", (double)ans / (double)n);
}
