#include <bits/stdc++.h>
using namespace std;
using namespace std;
vector<int> occ[26];
int dupl[26];
int main() {
  iostream::sync_with_stdio(0);
  cin.tie(0);
  string str;
  cin >> str;
  int n = str.size();
  str += str;
  for (int i = 0; i < n; i++) {
    occ[str[i] - 'a'].emplace_back(i);
  }
  int win = 0;
  int numpbs = 0;
  int prob = 0;
  for (vector<int> &occs : occ) {
    if (occs.size() == 0) continue;
    int mxndc = 0;
    for (int i = 0; i < n; i++) {
      int ndc = 0, wo = 0;
      for (int loc : occs) {
        int element = str[loc + i] - 'a';
        dupl[element]++;
        if (dupl[element] == 1) {
          wo++;
        }
        if (dupl[element] == 2) {
          wo--;
        }
      }
      mxndc = max(mxndc, wo);
      memset(dupl, 0, sizeof(dupl));
    }
    prob += mxndc;
  }
  cout.precision(15);
  cout << fixed << double(prob) / n;
}
