#include <bits/stdc++.h>
using namespace std;
signed main() {
  string s;
  cin >> s;
  long long N = s.size();
  vector<long long> pos[26];
  for (long long i = 0; i < (N); i++) {
    pos[s[i] - 'a'].push_back(i);
  }
  s += s;
  double ans = 0;
  for (long long c = 0; c < 26; c++) {
    long long maxVal = 0;
    for (long long shift = 1; shift < N; shift++) {
      long long count_unique = 0;
      long long cnt[26] = {0};
      for (auto p : pos[c]) {
        cnt[s[p + shift] - 'a']++;
        if (cnt[s[p + shift] - 'a'] == 1) count_unique++;
        if (cnt[s[p + shift] - 'a'] == 2) count_unique--;
      }
      maxVal = max(maxVal, count_unique);
    }
    ans += (double)maxVal / N;
  }
  printf("%.20lf\n", ans);
}
