#include <bits/stdc++.h>
using namespace std;
int n;
string s;
vector<int> pos[26];
int xd[26];
int main() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    pos[s[i] - 'a'].push_back(i);
    xd[s[i] - 'a']++;
  }
  double ans = 0;
  for (char c = 'a'; c <= 'z'; c++) {
    int best = 0;
    for (int shift = 0; shift < n; shift++) {
      vector<int> cnt(26, 0);
      for (int i : pos[c - 'a']) {
        cnt[s[(i + shift) % n] - 'a']++;
      }
      int nunique = 0;
      for (int i = 0; i < 26; i++) {
        if (cnt[i] == 1) {
          nunique++;
        }
      }
      best = max(best, nunique);
    }
    ans += 1.0 * best / n;
  }
  printf("%.10lf\n", ans);
  return 0;
}
