#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
char s[maxn];
int cnt[26][maxn][26];
int tot[26];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < n; i++) tot[s[i] - 'a']++;
  for (int k = 1; k < n; k++)
    for (int i = 0; i < n; i++) {
      int a = s[i] - 'a';
      int b = s[(i + k) % n] - 'a';
      cnt[a][k][b]++;
    }
  double ans = 0.0;
  for (int i = 0; i < 26; i++) {
    if (tot[i] == 0) continue;
    int C = 0;
    for (int k = 1; k < n; k++) {
      int tmp = 0;
      for (int j = 0; j < 26; j++)
        if (cnt[i][k][j] == 1) tmp++;
      C = max(C, tmp);
    }
    ans += 1.0 * C / n;
  }
  printf("%.8f\n", ans);
  return 0;
}
