fabbbhgedd
 abbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaab
 hcdhgcchbdhbeagdcfedgcbaffebgcbcccadeefacbhefgeadfgchabgeebegahfgegahbddedfhffeadcedadgfbeebhgfahhfb
 khjcoijiicdkdianmdolmadobdkcmgifdnffddnjehhbldlkjffknficdcmokfacioiegjedbmadjioomdacbodcajcmonmnlabo
 bababbdaee
 cbbbbcaaca
 gaejllebhn
 eaaebccaeacdecaedcaabbbdeebccdcdaabeeaeeaddbaabdccebecebbbbedbdcbbbbbbecbaddcddcccdcbbadbecddecedbba
 difhjdjbcdjedhiegagdejkbjfcdcdagdijdjajecbheiabfbjdgjdecfhdkgdbkcgcgakkiiggfkgcfadkjhiijkjacgejfhjge
 bbababaaababaabbbbbabbbbbbaaabbabaaaaabbbbbaaaabbbbabaabaabababbbabbabbabaaababbabbababaaaaabaaaabbb
 cadbcdddda
 kpsaloedscghjeaqadfhmlibjepjafdomkkorinrpakondtnrnknbqarbejcenrlsbfgdbsdmkpphbkdnbitjfcofsjibssmmlll
 aaabbbaaaabbbbaaabbbbbaabbbbaaababbaaabbbbaaabbbbababbbbaaabbbbaaabbbbbaabbbbaaabbbbaaabbbb
 ibledofnibedebifmnjdoaijeghajecbkjaebbkofnacceaodiifbhgkihkibddneeiemacodeafeaiiiaoajhmkjffbmmiehebhokfklhbkeoanoajdedjdlkbhenidclagggfhhhldfleccgmjbkhaginlhabkabagikalccndciokabfaebjkndf
 abbacba
 jkeaagakbifeaechkifkdghcjcgighidcgdccfbdbcackfgaebkddabgijkhjkaffkabacekdkjekeccegbecbkecbgbgcacgdackcdfjefaifgbigahkbedidfhjbikejdhejcgideaeejdcegeeccaefbddejkbdkfagfcdjbikbidfggkidcdcic

1.000000000000000
 0.000000000000000
 0.450000000000000
 0.960000000000000
 1.000000000000000
 0.800000000000000
 1.000000000000000
 0.080000000000000
 0.840000000000000
 0.000000000000000
 0.800000000000000
 1.000000000000000
 0.000000000000000
 0.786096256684492
 1.000000000000000
 0.438502673796791

#include <bits/stdc++.h>
using std::cin;
using std::cout;
template <class _Tp>
inline _Tp abs(const _Tp &x) {
  return x < 0 ? -x : x;
}
template <class _Tp>
inline _Tp max(const _Tp &a, const _Tp &b) {
  return a > b ? a : b;
}
template <class _Tp>
inline _Tp min(const _Tp &a, const _Tp &b) {
  return a < b ? a : b;
}
template <class _Tp>
inline void inc(_Tp &a, const _Tp &b) {
  if (a < b) a = b;
}
template <class _Tp>
inline void dec(_Tp &a, const _Tp &b) {
  if (a > b) a = b;
}
template <class _Tp>
inline void swp(_Tp &a, _Tp &b) {
  _Tp c = a;
  a = b;
  b = c;
}
template <class _Tp>
inline bool operator==(const _Tp &A, const _Tp &B) {
  return !memcmp(&A, &B, sizeof(_Tp));
}
int f[26][5005][26], l, tot, ans;
char s[5005];
int main() {
  scanf("%s", s);
  l = strlen(s);
  for (int i = 0; i < l; ++i) {
    int c = s[i] - 'a';
    for (int j = 1; j < l; ++j) {
      int c2 = s[(i + j) % l] - 'a';
      ++f[c][j][c2];
    }
  }
  tot = l;
  for (int i = (0); i < (26); ++i) {
    int mx = 0;
    for (int j = 1; j < l; ++j) {
      int cnt = 0;
      for (int k = (0); k < (26); ++k) {
        if (f[i][j][k] == 1) ++cnt;
      }
      inc(mx, cnt);
    }
    ans += mx;
  }
  printf("%.16lf\n", ans / (double)tot);
  return 0;
}
