#include <bits/stdc++.h>
using namespace std;
int const N = 100020;
int arr[26][5002][26];
char s[5002];
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; ++i) {
    for (int x = i + 1, j = 1; j < len; j++, x++) {
      if (x >= len) x %= len;
      arr[s[i] - 'a'][j][s[x] - 'a']++;
    }
  }
  int can = 0;
  for (int i = 0; i < 26; i++) {
    int mx = 0;
    for (int x = 0; x < len; x++) {
      int cur = 0;
      for (int j = 0; j < 26; j++) {
        if (arr[i][x][j] == 1) cur++;
      }
      mx = max(cur, mx);
    }
    can += mx;
  }
  printf("%.9f\n", (can * 1.0) / len);
  return 0;
}
