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;
long int req[30][30][5000], hum = 193, som[30];
int main() {
  double q, r;
  map<double, int> map2;
  map<double, int>::iterator fin;
  long int a, b = 0, c, d = 0, i, n, k = 3, s = 0;
  map<pair<char, char>, long int> map1, map3;
  map<pair<char, char>, long int>::iterator it, p;
  string wor, tor;
  cin >> wor;
  n = wor.length();
  tor = wor + wor;
  for (i = 0; i < n; i++) som[wor[i] + 'a' - 193] = som[wor[i] + 'a' - 193] + 1;
  for (i = 0; i <= 26; i++)
    for (c = 0; c <= 26; c++)
      for (k = 0; k < n; k++) req[i][c][k] = -1;
  for (k = 1; k < n; k++) {
    d = 0;
    for (i = 0; i < n; i++) {
      if (req[(tor[i] + 'a') - 193][(tor[i + k] + 'a') - 193][k] == -1)
        req[(tor[i] + 'a') - 193][(tor[i + k] + 'a') - 193][k] = 1;
      else
        req[(tor[i] + 'a') - 193][(tor[i + k] + 'a') - 193][k] = 0;
    }
  }
  b = 0;
  s = 0;
  d = 0;
  for (c = 1; c <= 26; c++) {
    for (k = 1; k < n; k++) {
      for (i = 1; i <= 26; i++)
        if (req[c][i][k] == 1) s = s + 1;
      b = max(s, b);
      s = 0;
    }
    d = d + min(b, som[c]);
    b = 0;
  }
  cout.precision(15);
  cout << fixed << (double)d / (double)n;
}
