#include <bits/stdc++.h>
using namespace std;
int check(vector<int> a, string s) {
  map<char, int> c;
  int n = s.size(), n1 = a.size(), maxx = 0, m = 0;
  for (int i = 1; i < n; i++) {
    for (int j : a) c[s[(j + i) % n]]++;
    for (pair<char, int> j : c)
      if (j.second == 1) m++;
    if (m == n1) return m;
    if (maxx < m) maxx = m;
    c.clear();
    m = 0;
  }
  return maxx;
}
int main() {
  vector<vector<int>> a(26, vector<int>());
  string s;
  int i, d = 0;
  getline(cin, s);
  for (i = 0; i < s.size(); i++) a[s[i] - 'a'].push_back(i);
  for (vector<int> j : a)
    if (j.size()) d += check(j, s);
  cout << (double)d / s.size();
  return 0;
}
