#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool cmax(T& x, T y) {
  return y > x ? x = y, true : false;
}
template <typename T>
inline bool cmin(T& x, T y) {
  return y < x ? x = y, true : false;
}
const int MAXN = 5005;
int N;
char s[MAXN];
int chk[26][26][MAXN];
int main() {
  scanf("%s", s);
  N = strlen(s);
  for (int i = 0; i <= N - 1; i++)
    for (int j = 0; j <= N - 1; j++) chk[s[i] - 'a'][s[(i + j) % N] - 'a'][j]++;
  double ans = 0;
  for (int i = 0; i <= 25; i++) {
    double cur = 0;
    for (int j = 0; j <= N - 1; j++) {
      int sum = 0;
      for (int k = 0; k <= 25; k++)
        if (chk[i][k][j] == 1) sum++;
      cmax(cur, (double)sum / N);
    }
    ans += cur;
  }
  printf("%.10lf\n", ans);
  return 0;
}
