#include <bits/stdc++.h>
using namespace std;
const int maxn = 5011;
char s[maxn << 1];
int n;
void init() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; ++i) s[i + n] = s[i];
}
void work() {
  int ans = 0;
  for (char c = 'a'; c <= 'z'; ++c) {
    static vector<int> q;
    q.clear();
    int res = 0;
    for (int i = 0; i < n; ++i)
      if (s[i] == c) q.push_back(i);
    for (int j = 0; j < n; ++j) {
      static int vis[30];
      memset(vis, 0, sizeof(vis));
      for (auto x : q) ++vis[s[x + j] - 'a'];
      int tmp = 0;
      for (int k = 0; k < 26; ++k)
        if (vis[k] == 1) ++tmp;
      res = max(res, tmp);
    }
    ans += res;
  }
  printf("%.7f\n", 1. * ans / n);
}
int main() {
  init();
  work();
  return 0;
}
