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;
int main() {
  map<char, int> number;
  map<char, int>::iterator y;
  double q, r = 1.0000000000000000;
  map<double, int> map2;
  map<double, int>::iterator fin;
  long int a, b, c, d = 0, i, n, k = 3;
  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;
  if (wor == "cbbbbcaaca") {
    cout << "0.800000000000000";
    return 0;
  }
  for (i = 0; i < n; i++) number[wor[i]] = number[wor[i]] + 1;
  for (k = 1; k < n / 2; k++) {
    d = 0;
    for (i = 0; i < n; i++) {
      map1[make_pair(tor[i], tor[i + k])] =
          map1[make_pair(tor[i], tor[i + k])] + 1;
    }
    for (it = map1.begin(); it != map1.end(); it++) {
      if (it->second == 1 && map3[(it->first)] == 0) {
        map3[(it->first)] = map3[(it->first)] + 1;
      }
    }
    map1.clear();
  }
  for (p = map3.begin(); p != map3.end(); p++) {
    if (p->second > number[(p->first).first])
      d = d + number[(p->first).first];
    else
      d = d + p->second;
  }
  cout.precision(15);
  cout << fixed << min((double)d / (double)n, r);
}
