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;
const long long mod = 1e9 + 7;
const int inf = (1 << 30);
const int MX = 1e5 + 9;
string s;
int cnt[MX];
double ans, mx;
vector<int> v[MX];
double Max[MX][200];
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) v[s[i]].push_back(i);
  for (int j = 'a'; j <= 'z'; j++) {
    for (int i = 1; i < s.size(); i++) {
      memset(cnt, 0, sizeof(cnt));
      double o = 0;
      for (int k = 0; k < v[j].size(); k++) {
        int nxt = v[j][k] + i;
        nxt %= int(s.size());
        cnt[s[nxt]]++;
      }
      for (int k = 'a'; k <= 'z'; k++) {
        if (cnt[k] == 1) o++;
      }
      Max[j][i] = o;
    }
  }
  for (int i = 'a'; i <= 'z'; i++) {
    double mx = 0;
    for (int k = 0; k < s.size(); k++) {
      mx = max(mx, Max[i][k]);
    }
    ans += mx;
  }
  double n = s.size();
  cout << setprecision(9) << fixed << (ans / n) << endl;
}
