#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  vector<string> v;
  for (int i = 0; i < s.size(); i++) {
    string s1 = s.substr(0, i), s2 = s.substr(i, s.size() - i);
    v.push_back(s2 + s1);
  }
  sort(v.begin(), v.end());
  long long start = 0;
  long long ans = 0;
  while (start < v.size()) {
    long long k = start;
    while (k < v.size() && v[k][0] == v[start][0]) k++;
    long long mx = 0;
    for (long long i = 0; i < s.size(); i++) {
      set<char> st;
      long long distnct[26] = {0};
      for (long long j = start; j < k; j++) {
        distnct[v[j][i] - 'a'] = 1;
        if (st.find(v[j][i]) != st.end()) distnct[v[j][i] - 'a'] = 0;
        st.insert(v[j][i]);
      }
      long long a1 = 0;
      for (long long i = 0; i < 26; i++)
        if (distnct[i]) a1++;
      mx = ((a1) > (mx) ? (a1) : (mx));
    }
    ans += mx;
    start = k;
  }
  cout << setprecision(20) << (double)ans / ((double)v.size()) << endl;
}
