#include <bits/stdc++.h>
const int maxn = 100010;
const int inf = ~(1u << 31u);
const long long linf = ~(1llu << 63u);
using namespace std;
int main() {
  string str;
  cin >> str;
  int n = str.length();
  vector<string> c[26];
  for (int i = 0; i < str.length(); i++) {
    c[str[i] - 'a'].push_back(str.substr(i, str.length() - i) +
                              str.substr(0, i));
  }
  double res = 0;
  for (auto &i : c) {
    int num = 0;
    for (int j = 0; j < n; j++) {
      vector<int> t(26);
      int ans = 0;
      fill(t.begin(), t.end(), 0);
      for (auto &k : i) t[k[j] - 'a']++;
      for (int &x : t) ans += (x == 1);
      num = max(num, ans);
    }
    res += (double)num / n;
  }
  printf("%.12f\n", res);
  return 0;
}
