#include <bits/stdc++.h>
using namespace std;
int ska[26];
vector<int> lol[26];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string a;
  cin >> a;
  for (int i = 0; i < a.size(); ++i) {
    lol[a[i] - 'a'].push_back(i);
  }
  long double ans = 0;
  for (int i = 0; i < 26; ++i) {
    int kek = 0;
    for (int s = 1; s < a.size(); ++s) {
      for (int p : lol[i]) {
        ++ska[a[(s + p) % a.size()] - 'a'];
      }
      int up = 0;
      for (int j = 0; j < 26; ++j) {
        up += (ska[j] == 1);
        ska[j] = 0;
      }
      kek = max(kek, up);
    }
    ans += kek / (long double)a.size();
  }
  cout << fixed << setprecision(7) << ans << "\n";
}
