#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
char s[MAXN];
int f[26][MAXN][26], num[26];
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = 1; i <= n; i++) num[s[i] - 'a']++;
  for (int i = 1; i <= n; i++) {
    int pos = 1;
    for (int j = i; j <= n; j++, pos++) f[s[i] - 'a'][pos][s[j] - 'a']++;
    for (int j = 1; j < i; j++, pos++) f[s[i] - 'a'][pos][s[j] - 'a']++;
  }
  double ans = 0.0;
  for (int i = 0; i < 26; i++) {
    int Max = 0;
    for (int j = 2; j <= n; j++) {
      int t = 0;
      for (int k = 0; k < 26; k++)
        if (f[i][j][k] == 1) t++;
      Max = max(Max, t);
    }
    ans += 1.0 * Max / n;
  }
  printf("%.6lf\n", ans);
  return 0;
}
