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() {
  string s;
  cin >> s;
  int n = (int)((s).size());
  s += s;
  double ans = 0.0;
  vector<vector<string>> v(26, vector<string>());
  for (int i = 0 - (0 > n); i != n - (0 > n); i += 1 - 2 * (0 > n)) {
    int a = s[i] - 'a';
    v[a].push_back(s.substr(i + 1, n - 1));
  }
  vector<int> val(26, 0);
  for (int i = 0 - (0 > 26); i != 26 - (0 > 26); i += 1 - 2 * (0 > 26)) {
    int ma = 0;
    for (int j = 0 - (0 > n - 1); j != n - 1 - (0 > n - 1);
         j += 1 - 2 * (0 > n - 1)) {
      vector<int> count(26, 0);
      int ct = 0;
      for (int k = 0 - (0 > (int)((v[i]).size()));
           k != (int)((v[i]).size()) - (0 > (int)((v[i]).size()));
           k += 1 - 2 * (0 > (int)((v[i]).size()))) {
        count[v[i][k][j] - 'a']++;
      }
      for (int k = 0 - (0 > 26); k != 26 - (0 > 26); k += 1 - 2 * (0 > 26)) {
        ct += (count[k] == 1);
      }
      ma = max(ma, ct);
    }
    val[i] = ma;
  }
  for (int i = 0 - (0 > n); i != n - (0 > n); i += 1 - 2 * (0 > n)) {
    ans += val[s[i] - 'a'] * 1.0 / (n * (int)((v[s[i] - 'a']).size()) * 1.0);
  }
  cout << setprecision(15) << ans << "\n";
  return 0;
}
