#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  vector<vector<int> > pos('z' - 'a' + 1);
  for (int i = 0; i < n; i++) pos[s[i] - 'a'].push_back(i);
  int good = 0;
  for (int c = 0; c <= 'z' - 'a'; c++) {
    if (pos[c].empty()) continue;
    int c_good = 0;
    for (int k = 0; k < n; k++) {
      int cnt['z' - 'a' + 1] = {};
      for (int i : pos[c]) cnt[s[(i + k) % n] - 'a']++;
      int cur_c_good = 0;
      for (int d = 0; d <= 'z' - 'a'; d++) cur_c_good += (cnt[d] == 1);
      c_good = max(c_good, cur_c_good);
    }
    good += c_good;
  }
  cout.precision(10);
  cout << fixed;
  cout << (double)good / n;
  return 0;
}
