#include <bits/stdc++.h>
using namespace std;
template <typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using maxpq = priority_queue<T, vector<T>, less<T>>;
template <typename T1, typename T2>
struct pair_hash {
  size_t operator()(const pair<T1, T2> &p) const {
    return 31 * hash<T1>{}(p.first) + hash<T2>{}(p.second);
  }
};
string S;
int freq[26], mm[26], mc[26];
vector<int> L[26];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> S;
  for (auto i = (0); i < (26); i++) freq[i] = 0;
  for (auto i = (0); i < (((int)(S).size())); i++) {
    freq[S[i] - 'a']++;
    L[S[i] - 'a'].push_back(i);
  }
  for (auto i = (0); i < (26); i++) {
    mc[i] = 0;
    if (freq[i] == 0) continue;
    if (((int)(L[i]).size()) == 1) {
      mc[i] = 1;
      continue;
    }
    for (auto j = (1); j < (((int)(S).size())); j++) {
      for (auto k = (0); k < (26); k++) mm[k] = 0;
      for (auto k = (0); k < (((int)(L[i]).size())); k++)
        mm[S[(L[i][k] + j) % ((int)(S).size())] - 'a']++;
      int cnt = 0;
      for (auto k = (0); k < (26); k++) cnt += (mm[k] == 1);
      ((mc[i]) = max((mc[i]), (cnt)));
      if (mc[i] == ((int)(L[i]).size())) break;
    }
  }
  int cnt = 0;
  for (auto i = (0); i < (26); i++) cnt += mc[i];
  cout << setprecision(9) << fixed
       << ((double)cnt) / ((double)((int)(S).size())) << '\n';
  return 0;
}
