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 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) {
      if (ab[i].size() <= 26) {
        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;
      } else {
        rez[i] = -1;
      }
    }
    i++;
  }
  cout << setprecision(10);
  cout << lab / sk;
  return 0;
}
