#include <bits/stdc++.h>
using namespace std;
vector<string> s[256];
int32_t main() {
  string t;
  cin >> t;
  int n = t.size();
  for (int i = 0; i < n; i++) {
    rotate(t.begin(), t.begin() + 1, t.end());
    s[t[0]].push_back(t);
  }
  int ans = 0;
  for (char c = 'a'; c <= 'z'; c++) {
    int sz = s[c].size();
    int mx = 0;
    for (int i = 1; i < n; i++) {
      vector<int> seen(26);
      for (int j = 0; j < sz; j++) {
        seen[s[c][j][i] - 'a']++;
      }
      int so = 0;
      for (int i = 0; i < 26; i++) so += seen[i] == 1;
      mx = max(mx, so);
    }
    ans += mx;
  }
  cout << fixed << setprecision(11);
  cout << 1.0 * ans / n << endl;
}
