#include <bits/stdc++.h>
using namespace std;
const long long N = 5e3 + 5;
string s;
vector<long long> pos[26];
double ans = 0, w[26];
void solve() {
  cin >> s;
  double n = s.size();
  for (long long i = 0; i < n; ++i) pos[s[i] - 'a'].push_back(i);
  for (long long i = 0; i < 26; ++i) {
    w[i] = 0;
    for (long long len = 1; len < n; ++len) {
      long long u[26];
      fill(u, u + 26, 0);
      for (long long j = 0; j < pos[i].size(); ++j) {
        long long p = pos[i][j];
        u[s[(p + len) % s.size()] - 'a']++;
      }
      double res = 0;
      for (long long j = 0; j < 26; ++j)
        if (u[j] == 1) res += 1;
      w[i] = max(w[i], res);
    }
    ans += (w[i] / n);
  }
  printf("%.12lf", ans);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
}
