#include <bits/stdc++.h>
using namespace std;
const int N = 26;
int k[N][N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  vector<string> s(1);
  cin >> s[0];
  int l = s[0].length();
  s.resize(l);
  for (int i = 1; i < l; ++i) {
    s[i] = s[i - 1];
    s[i] += s[i][0];
    s[i].erase(s[i].begin());
  }
  long double best = 0;
  sort(s.begin(), s.end());
  int prev = 0;
  for (int pos = 0; pos < l; ++pos) {
    if (pos == l - 1 || s[pos][0] != s[pos + 1][0]) {
      long double tmp = 0;
      for (int i = 1; i < l; ++i) {
        for (int j = 0; j < N; ++j) {
          for (int h = 0; h < N; ++h) {
            k[j][h] = 0;
          }
        }
        for (int j = prev; j <= pos; ++j) {
          ++k[s[j][0] - 'a'][s[j][i] - 'a'];
        }
        long double cur = 0;
        for (int j = 0; j < N; ++j) {
          for (int h = 0; h < N; ++h) {
            if (k[j][h] == 1) {
              ++cur;
            }
          }
        }
        cur /= l;
        tmp = max(cur, tmp);
      }
      best += tmp;
      prev = pos + 1;
    }
  }
  cout.precision(20);
  cout << fixed << best;
  return 0;
}
