#include <bits/stdc++.h>
using namespace std;
int g[30][5002][30];
int cnt[33];
int main() {
  string s;
  cin >> s;
  int n = s.size();
  double ans = 0;
  memset(cnt, 0, sizeof(cnt));
  memset(g, 0, sizeof(g));
  for (int i = 0; i < n; ++i) {
    cnt[s[i] - 'a']++;
    for (int j = 1; j < n; ++j) {
      g[s[i] - 'a'][j][s[(i + j) % n] - 'a']++;
    }
  }
  int flag, tot;
  double ma, cur;
  for (int i = 0; i < 26; ++i) {
    ma = 0;
    for (int j = 1; j < n; ++j) {
      cur = 0;
      for (int k = 0; k <= 25; ++k) {
        if (g[i][j][k] == 1) {
          cur += 1.0 / (double)n;
        }
      }
      ma = max(ma, cur);
    }
    ans += ma;
  }
  printf("%.9lf\n", ans);
}
