#include <bits/stdc++.h>
using namespace std;
string s;
double ans;
int cnt[200];
vector<int> v[200];
int main() {
  cin >> s;
  double n = s.size();
  for (int i = 0; i < n; i++) v[s[i]].push_back(i);
  for (char i = 'a'; i <= 'z'; i++) {
    if (!v[i].empty()) {
      int x = v[i][0];
      int y = 0;
      for (int k = 0; k < n; k++) {
        memset(cnt, 0, sizeof cnt);
        for (int j = 0; j < v[i].size(); j++) {
          v[i][j]++;
          v[i][j] %= (int)n;
          cnt[s[v[i][j]]]++;
        }
        int cur = 0;
        for (int j = 'a'; j <= 'z'; j++) cur += (cnt[j] == 1);
        y = max(y, cur);
      }
      ans += y;
    }
  }
  cout << fixed << setprecision(8) << (ans / n);
  return 0;
}
