#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 10;
const int maxm = 2e6 + 10;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int casn, n, m, k;
int dp[27][27][maxn];
int main() {
  string s;
  cin >> s;
  n = s.size() - 1;
  for (int i = 0; i <= n; i++) s[i] -= 'a';
  for (int i = 0; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      dp[s[i]][s[(i + j) % (n + 1)]][j]++;
    }
  }
  double ans = 0;
  for (int i = 0; i <= 25; i++) {
    double tmp = 0;
    for (int j = 1; j <= n; j++) {
      double a = 0, b = 0;
      for (int k = 0; k <= 25; k++) {
        if (dp[i][k][j] == 1) ++a;
      }
      if (tmp < a) tmp = a;
    }
    ans += tmp / (n + 1);
  }
  printf("%.10f\n", ans);
  return 0;
}
