#include <bits/stdc++.h>
using namespace std;
list<int> ab[30];
int i, j, k, n, m, mas[10005], l[30], rez[30], t[30], aa, kk;
double sk, out, lab;
string s;
char c;
int main() {
  std::cin.sync_with_stdio(false);
  std::cin.tie(0);
  cin >> s;
  i = 0;
  while (i < s.length()) {
    mas[i] = s[i];
    mas[i + s.length()] = mas[i];
    c = mas[i];
    l[c - 97]++;
    ab[c - 97].push_back(i);
    i++;
  }
  n = s.length();
  i = 0;
  while (i < 30) {
    if (l[i] != 0) {
      aa = 0;
      k = 1;
      rez[i] = 0;
      kk = 0;
      while (k <= n && rez[i] == 0) {
        j = 0;
        while (j < 30) {
          t[j] = 0;
          j++;
        }
        aa = 0;
        for (int j : ab[i]) {
          t[mas[j + k] - 97]++;
          j++;
        }
        j = 0;
        int rr = 0;
        while (j < 30) {
          if (t[j] > 1) {
            aa = 1;
          }
          if (t[j] == 1) {
            rr++;
          }
          j++;
        }
        kk = max(kk, rr);
        if (aa == 0) {
          rez[i] = 1;
        }
        k++;
      }
      if (rez[i] == 0) {
        rez[i] = -1;
      }
      sk += ab[i].size();
      lab += kk;
    }
    i++;
  }
  cout << setprecision(10);
  cout << lab / sk;
  return 0;
}
