#include <bits/stdc++.h>
using namespace std;
string S;
vector<int> v[26];
int cnt[26];
int main() {
  cin >> S;
  int len = S.length();
  for (int i = 0; i < len; i++) {
    v[S[i] - 'a'].push_back(i);
    cnt[S[i] - 'a']++;
  }
  long double fans = 0.000000;
  for (int i = 0; i < 26; i++) {
    if (!cnt[i]) continue;
    int mx = 0;
    for (int j = 2; j <= len; j++) {
      int tmp[26] = {0};
      for (int k = 0; k < v[i].size(); k++) {
        int idx = v[i][k] + j - 1;
        if (idx >= len) {
          idx -= len;
        }
        idx = S[idx] - 'a';
        tmp[idx]++;
      }
      int val = 0;
      for (int k = 0; k < 26; k++) {
        if (tmp[k] == 1) {
          val++;
        }
      }
      mx = max(mx, val);
    }
    fans += mx * 1.000000 / len;
  }
  cout << fixed << setprecision(15);
  cout << fans << endl;
  return 0;
}
