#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lf = long double;
using pii = pair<int, int>;
using ppi = pair<int, pii>;
using pll = pair<ll, ll>;
using pff = pair<lf, lf>;
using ti = tuple<int, int, int>;
using base = complex<double>;
const lf PI = 3.14159265358979323846264338L;
template <typename T>
inline T umax(T& u, T v) {
  return u = max(u, v);
}
template <typename T>
inline T umin(T& u, T v) {
  return u = min(u, v);
}
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
string s, t;
vector<int> pos[26];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> t;
  int l = ((int)(t).size());
  s = t + t;
  for (int i = 0; i < l; i++) pos[s[i] - 'a'].push_back(i);
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    if (pos[i].empty()) continue;
    int lans = 0;
    for (int j = 1; j < l; j++) {
      int c[26] = {};
      for (int k : pos[i]) {
        c[s[k + j] - 'a']++;
      }
      lans = max(lans, int(count(c, c + 26, 1)));
    }
    ans += lans;
  }
  cout << fixed;
  cout.precision(10);
  cout << lf(ans) / l << '\n';
}
