#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e3 + 5;
int n, cnt[26][26][maxn];
char s[maxn * 2];
int main() {
  memset(cnt, 0, sizeof(cnt));
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; i++) s[n + i] = s[i];
  for (int l = 0; l < n; l++) {
    for (int r = l + 1; r < l + n; r++) {
      cnt[s[l] - 'a'][s[r] - 'a'][r - l + 1]++;
    }
  }
  int num = 0;
  for (int l = 0; l < 26; l++) {
    int ccnt = 0;
    for (int len = 1; len <= n; len++) {
      int sum = 0;
      for (int a = 0; a < 26; a++) {
        if (cnt[l][a][len] == 1) sum++;
      }
      ccnt = max(ccnt, sum);
    }
    num += ccnt;
  }
  printf("%.16f\n", (double)num / n);
  return 0;
}
