#include <bits/stdc++.h>
using namespace std;
string t;
double ans = 0;
vector<int> spot[256];
int form(int i) { return i >= t.size() ? i - t.size() : i; }
int main() {
  cin >> t;
  for (int i = 0; i < t.size(); ++i) spot[t[i]].push_back(i);
  for (char f = 'a'; f <= 'z'; ++f) {
    if (spot[f].empty()) continue;
    int maxwin = 0;
    for (int g = 1; g < t.size(); ++g) {
      vector<int> cnt(26, 0);
      for (auto &i : spot[f]) {
        ++cnt[t[form(i + g)] - 'a'];
      }
      int quan = 0;
      for (int i = 0; i < 26; ++i) {
        quan += (cnt[i] == 1);
      }
      maxwin = max(maxwin, quan);
    }
    ans += (spot[f].size()) * ((double)maxwin / (double)spot[f].size());
  }
  printf("%.10f", ans / (double)t.size());
}
