#include <bits/stdc++.h>
using namespace std;
const int N = 5000 + 10;
int n;
char s[N];
vector<int> g[26];
int main() {
  scanf(" %s", s);
  n = strlen(s);
  for (int i = 0; i < n; ++i) g[s[i] - 'a'].push_back(i);
  double ans = 0;
  for (int i = 0; i < 26; ++i) {
    double cur = 0;
    for (int j = 0; j < n; ++j) {
      map<int, int> cnt;
      for (int k = 0; k < g[i].size(); ++k) cnt[s[(j + g[i][k]) % n] - 'a']++;
      double foo = 0;
      for (int k = 0; k < 26; ++k) foo += (cnt[k] == 1);
      cur = max(cur, foo);
    }
    ans += cur;
  }
  printf("%.10lf\n", ans / (double)n);
  return 0;
}
