#include <bits/stdc++.h>
using namespace std;
int cou[26][5000][26];
char s[5001];
bool can[26];
int main() {
  memset((cou), 0, sizeof(cou));
  scanf("%s", s);
  int n = strlen(s);
  for (int k = 0; k < n; k++) {
    char new_s[5001];
    {
      int i = 0;
      for (int j = k; j < n; j++) new_s[i++] = s[j];
      for (int j = 0; j < k; j++) new_s[i++] = s[j];
    }
    for (int i = 1; i < n; i++) {
      cou[new_s[0] - 'a'][i][new_s[i] - 'a']++;
    }
  }
  memset((can), 0, sizeof(can));
  int x = 0;
  int y = n;
  for (int i = 0; i < 26; i++) {
    int best = 0;
    for (int j = 1; j < n; j++) {
      int z = 0;
      for (int k = 0; k < 26; k++) {
        if (cou[i][j][k] == 1) z++;
      }
      best = max(best, z);
    }
    x += best;
  }
  printf("%.9lf\n", (double)x / (double)y);
  return 0;
}
