#include <bits/stdc++.h>
using namespace std;
string s;
int last[500];
int maxu, tmp;
vector<int> a[500];
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) a[s[i]].push_back(i);
  double hello = 0;
  int mod = s.size();
  for (char i = 'a'; i <= 'z'; i++) {
    maxu = 0;
    tmp = 0;
    for (int k = 1; k < s.size(); k++) {
      memset(last, 0, sizeof(last));
      tmp = 0;
      for (auto j : a[i]) last[s[(j + k) % mod]]++;
      for (char t = 'a'; t <= 'z'; t++)
        if (last[t] == 1) tmp++;
      maxu = max(maxu, tmp);
    }
    hello += maxu;
  }
  cout << fixed << setprecision(10) << hello / (double)mod << endl;
}
