#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 10;
int v[30];
vector<int> V[30];
int main() {
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < s.length(); i++) {
    V[s[i] - 'a'].push_back(i);
  }
  double ans = 0;
  int sum = 0;
  for (int i = 0; i < 26; i++) {
    if (V[i].size()) {
      int mx = 0;
      for (int j = 1; j < n; j++) {
        int c = 0;
        memset(v, 0, sizeof v);
        for (int x : V[i]) {
          int q = s[(x + j) % n] - 'a';
          if (v[q] == 0)
            c++;
          else if (v[q] == 1)
            c--;
          v[q]++;
        }
        mx = max(mx, c);
      }
      sum += mx;
    }
  }
  printf("%.10f\n", sum * 1.0 / n);
  return 0;
}
