#include <bits/stdc++.h>
const int N = 5005;
using namespace std;
int n, ff[N], num[26];
char s[N << 1];
vector<int> v[26];
int main() {
  scanf(" %s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i) s[i + n] = s[i];
  for (int i = 1; i <= n; ++i) v[s[i] - 'a'].push_back(i);
  for (int i = 0; i <= 25; ++i) {
    for (int x = 1; x <= n - 1; ++x) {
      int f = 0;
      memset(num, 0, sizeof(num));
      for (auto p : v[i]) {
        ++num[s[p + x] - 'a'];
      }
      int tt = 0;
      for (int j = 0; j <= 25; ++j)
        if (num[j] == 1) ++tt;
      ff[i] = max(ff[i], tt);
    }
  }
  int tmp = 0;
  for (int i = 0; i <= 25; ++i) tmp += ff[i];
  printf("%.10f\n", 1.0 * tmp / (double)n);
  return 0;
}
