#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  string s;
  cin >> s;
  long long n = s.length();
  vector<long long> v[26];
  for (int i = 0; i < n; ++i) {
    v[s[i] - 'a'].push_back(i);
  }
  double ans = 0;
  for (int i = 0; i < 26; ++i) {
    if (v[i].size() <= 1) {
      ans += v[i].size();
      continue;
    }
    long long max1 = 0;
    for (int j = 0; j < n; ++j) {
      long long temp = 0;
      int a[26] = {0};
      for (int k = 0; k < v[i].size(); ++k) {
        a[s[(v[i][k] + j) % n] - 'a']++;
      }
      for (int k = 0; k < 26; ++k) {
        if (a[k] == 1) temp++;
      }
      max1 = max(max1, temp);
    }
    ans += max1;
  }
  ans /= (1.0 * n);
  cout << setprecision(15) << ans << "\n";
  return 0;
}
