#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  vector<vector<string>> v(26);
  long long n = s.size();
  s += s;
  for (long long i = 0; i < n; ++i) {
    string p = s.substr(i, n);
    v[p[0] - 'a'].push_back(p);
  }
  long long can = 0;
  for (long long i = 0; i < 26; ++i) {
    long long st = v[i].size();
    if (st != 0) {
      long long mx = 0;
      for (long long j = 0; j < n; ++j) {
        long long count[26] = {};
        for (long long k = 0; k < v[i].size(); ++k) {
          char c = v[i][k][j];
          count[c - 'a']++;
        }
        long long curr = 0;
        for (long long l = 0; l < 26; ++l) {
          if (count[l] == 1) {
            curr++;
          }
        }
        mx = max(mx, curr);
      }
      can += mx;
    }
  }
  cout << setprecision(10) << (double)can / (double)n << endl;
  return 0;
}
