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;
using ll = long long;
int b[26];
bool bb[26];
bool ss[5000];
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  map<char, vector<int>> m;
  for (int i = 0; i < s.size(); ++i) {
    m[s[i]].push_back(i);
  }
  for (int i = 0; i < 5000; ++i) {
    ss[i] = false;
  }
  for (auto& a : m) {
    for (int i = 0; i < 26; ++i) {
      bb[i] = false;
    }
    for (int k = 0; k < s.size(); ++k) {
      bool ok = true;
      for (int i = 0; i < 26; ++i) {
        b[i] = bb[i] ? -1 : -2;
      }
      for (int pos : a.second) {
        int c = (int)s[(pos + k) % s.size()] - 'a';
        if (b[c] == -1) {
          continue;
        }
        if (b[c] >= 0) {
          b[c] = -1;
          continue;
        }
        if (b[c] == -2) {
          b[c] = pos;
        }
      }
      for (int i = 0; i < 26; ++i) {
        if (b[i] >= 0) {
          cerr << "true for pos:"
               << " " << b[i] << endl;
          cerr << "succ at k:"
               << " " << k << endl;
          ss[b[i]] = true;
          bb[i] = true;
        }
      }
    }
  }
  ll succ = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (ss[i]) {
      ++succ;
    }
  }
  cerr << "succ:"
       << " " << succ << endl;
  double prob = (double)succ / s.size();
  cout << prob << endl;
}
