#include <bits/stdc++.h>
using namespace std;
const long long infl = 1e18 + 5;
long long n, m, k, q, x, y, f, val, t, i, j;
long long ind, cnt, sz, sm, ans, mx, mn;
long long a[1000004];
vector<int> v[28];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("inp.txt", "r")) {
    freopen("myfile.txt", "w", stdout);
    freopen("inp.txt", "r", stdin);
  }
  string s;
  cin >> s;
  n = s.size();
  for (i = 0; i < n; i++) {
    v[s[i] - 'a'].emplace_back(i);
  }
  ans = 0;
  long long inans = 0;
  for (i = 0; i < 28; i++) {
    k = v[i].size();
    if (k < 2) {
      ans += k;
      continue;
    }
    vector<int> v1;
    inans = 0;
    for (cnt = 1; cnt < n; cnt++) {
      v1.clear();
      for (j = 0; j < k; j++) {
        v1.emplace_back((v[i][j] + cnt) % n);
      }
      vector<int> vc(28, 0);
      for (j = 0; j < k; j++) {
        vc[s[v1[j]] - 'a']++;
      }
      val = 0;
      for (j = 0; j < 28; j++) {
        if (vc[j] == 1) {
          val++;
        }
      }
      inans = max(inans, val);
    }
    ans += inans;
  }
  double dans = (ans * 1.0 / n);
  cout << fixed << setprecision(9) << dans;
  return 0;
}
