#include <bits/stdc++.h>
using namespace std;
const int p = 1e4 + 7;
string a;
set<int> s;
vector<int> poz[30];
int up, ok, In[30], uz;
int P(char x) { return (x - 'a'); }
double best = 0, rez = 0;
int main() {
  cin >> a;
  for (int i = 0; i < a.length(); i++) {
    poz[P(a[i])].push_back(i);
  }
  for (int i = 0; i < 30; i++) {
    if (poz[i].size() > 0) {
      best = 0, uz = 0;
      for (int k = 0; k < a.length(); k++) {
        for (int j = 0; j < poz[i].size(); j++) {
          int y = (poz[i][j] + k) % a.length();
          int x = P(a[y]);
          In[x]++;
        }
        int cnt = 0;
        for (int f = 0; f < 30; f++) {
          if (In[f] == 1) {
            cnt++;
          }
          In[f] = 0;
        }
        uz = max(cnt, uz);
      }
      double s = (double)uz / poz[i].size();
      double d = (double)poz[i].size() / a.length();
      rez += s * d;
    }
  }
  printf("%.8lf", rez);
  return 0;
}
