#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 5, TmpS = 30;
long double A[N][TmpS][TmpS], Tmp, Tmp2, l;
long double p;
string s, stmp;
inline void Do(char c, string t) {
  for (int i = 0; i < (long double)t.size(); i++) A[i][t[i] - 'a'][c - 'a']++;
}
int main() {
  cin >> s;
  l = (long double)s.size();
  for (int i = 0; i < l; i++) {
    Do(s[0], s);
    stmp = "", stmp += s[l - 1];
    for (int j = 0; j < l - 1; j++) stmp += s[j];
    s = stmp;
  }
  for (char ic = 'a'; ic <= 'z'; ic++) {
    Tmp = 0;
    for (int i = 0; i < l; i++) {
      Tmp2 = 0;
      for (char j = 'a'; j <= 'z'; j++) {
        if (A[i][j - 'a'][ic - 'a'] == 1) Tmp2++;
      }
      Tmp = max<long double>(Tmp, Tmp2);
    }
    p += Tmp;
  }
  cout << fixed << setprecision(12);
  cout << (p / ((long double)l));
}
