#include <bits/stdc++.h>
using namespace std;
const int MAX = 5000 + 5;
const int ALFA = 26 + 5;
int n;
int cnt[ALFA];
int q[ALFA];
string s;
double calc(char c) {
  int a = 0, b = 0;
  int maxx = 0;
  for (auto first : s)
    if (first == c) a++;
  if (!a) return 0;
  for (int t = (1), _for = (n); t < _for; ++t) {
    for (int i = (0), _for = (26); i < _for; ++i) q[i] = 0;
    for (int i = (0), _for = (n); i < _for; ++i)
      if (s[i] == c) {
        int r = (i + t) % n;
        q[(int)s[r] - 'a']++;
      }
    b = 0;
    for (auto first : q)
      if (first == 1) b++;
    maxx = max(maxx, b);
  }
  return 1.0 * maxx / a;
}
int main() {
  cin >> s;
  n = s.size();
  for (auto first : s) {
    cnt[(int)first - 'a']++;
  }
  double ans = 0;
  for (int i = (0), _for = (26); i < _for; ++i)
    ans += 1.0 * calc('a' + i) * cnt[i] / n;
  printf("%.12lf\n", ans);
  return 0;
}
