#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  vector<int> v[26];
  for (int i = int(0); i <= int(n - 1); i++) v[s[i] - 'a'].push_back(i);
  double ans = 0;
  for (int i = int(0); i <= int(25); i++) {
    int mx = 0;
    for (int j = int(1); j <= int(n - 1); j++) {
      int tl = 0;
      int cnt[26] = {0};
      for (auto it : v[i]) cnt[s[(it + j) % n] - 'a']++;
      for (int k = int(0); k <= int(25); k++)
        if (cnt[k] == 1) tl++;
      mx = max(mx, tl);
    }
    ans += mx;
  }
  cout << setprecision(15) << ans / n;
}
