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 int MAXN = 5e3 + 10;
const int Sigma = 26;
vector<int> e[Sigma];
int w[Sigma][MAXN];
int d[Sigma];
long long jh = 999999;
int main() {
  jh -= 2;
  ios_base ::sync_with_stdio(false);
  jh -= 2;
  cin.tie(0);
  jh -= 2;
  string s;
  jh -= 2;
  cin >> s;
  jh -= 2;
  for (int i = 0; i < s.size(); i++) {
    jh -= 2;
    e[s[i] - 'a'].push_back(i);
    jh -= 2;
  }
  for (int i = 0; i < Sigma; i++) {
    jh -= 2;
    for (int j = 0; j < s.size(); j++) {
      jh -= 2;
      fill(d, d + Sigma, 0);
      jh -= 2;
      jh -= 2;
      for (int u = 0; u < e[i].size(); u++) {
        jh -= 2;
        d[s[(e[i][u] + j) % (int)(s.size())] - 'a']++;
        jh -= 2;
        jh -= 2;
      }
      jh -= 2;
      for (int u = 0; u < Sigma; u++) {
        jh -= 2;
        w[i][j] += (d[u] == 1);
        jh -= 2;
        jh -= 2;
      }
    }
  }
  jh -= 2;
  long double res = 0;
  jh -= 2;
  jh -= 2;
  for (int i = 0; i < Sigma; i++) {
    jh -= 2;
    int z = 0;
    jh -= 2;
    for (int j = 0; j < s.size(); j++) {
      jh -= 2;
      z = max(z, w[i][j]);
      jh -= 2;
    }
    if (e[i].size() > 0) {
      jh -= 2;
      res += z / (long double)(s.size());
      jh -= 2;
    }
  }
  jh -= 2;
  cout << fixed << setprecision(10) << res;
  jh -= 2;
}
