#include <bits/stdc++.h>
using namespace std;
template <class X, class Y>
void minimize(X &x, const Y &y) {
  if (x > y) x = y;
}
template <class X, class Y>
void maximize(X &x, const Y &y) {
  if (x < y) x = y;
}
template <class T>
T Abs(const T &x) {
  return (x < 0 ? -x : x);
}
int cnt[26][5050][26], cntStr[26];
double solve(string s) {
  memset(cnt, 0, sizeof cnt);
  memset(cntStr, 0, sizeof cntStr);
  int n = s.size();
  for (__typeof((s).begin()) it = (s).begin(); it != (s).end(); it++)
    cntStr[*it - 'a']++;
  for (int i = 0, _n = (n); i < _n; i++)
    for (int j = 0, _n = (n); j < _n; j++)
      cnt[s[i] - 'a'][j][s[(i + j) % n] - 'a']++;
  int res = 0;
  for (int i = 0, _n = (26); i < _n; i++) {
    int best = -1;
    for (int j = 0, _n = (n); j < _n; j++) {
      int tmp = 0;
      for (int k = 0, _n = (26); k < _n; k++)
        if (cnt[i][j][k] == 1) tmp++;
      maximize(best, tmp);
    }
    res += best;
  }
  return 1.0 * res / n;
}
int main(void) {
  string s;
  while (cin >> s) printf("%.9lf\n", solve(s));
  return 0;
}
