#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> a(26, vector<int>());
  map<char, int> c;
  string s;
  getline(cin, s);
  int n = s.size(), i, d = 0;
  for (i = 0; i < s.size(); i++) a[s[i] - 'a'].push_back(i);
  for (vector<int> j : a)
    if (j.size()) {
      int n1 = j.size(), max = 0, m;
      for (i = 1; i < n; i++) {
        c.clear();
        m = 0;
        for (int k : j) c[s[(k + i) % n]]++;
        for (pair<char, int> k : c)
          if (k.second == 1) m++;
        if (m == n1) {
          max = m;
          break;
        }
        if (max < m) max = m;
      }
      d += max;
    }
  cout << (double)d / s.size();
  return 0;
}
