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 const bound = 1e6 + 2, N = 2e5 + 2;
long long OO = 1e18;
double eps = 1e-6;
int oo = 1e9, mod = oo + 9;
char cc[5001];
int fr[26];
vector<string> all;
int cnt[5001][26][26], cnt2[5001][26];
int main() {
  scanf("%s", cc);
  int l = strlen(cc);
  for (int(i) = 0; (i) < (l); (i)++) fr[cc[i] - 'a']++;
  string cur = cc;
  all.push_back(cur);
  for (int(i) = 1; (i) <= (l - 1); (i)++) cnt[i][cur[0] - 'a'][cur[i] - 'a']++;
  for (int(i) = 0; (i) < (l - 1); (i)++) {
    string tm;
    tm += cur.back();
    cur.pop_back();
    tm += cur;
    all.push_back(tm);
    cur = tm;
    for (int(i) = 1; (i) <= (l - 1); (i)++)
      cnt[i][cur[0] - 'a'][cur[i] - 'a']++;
  }
  double prob = 0;
  for (auto y : all)
    for (int(i) = 1; (i) <= (l - 1); (i)++)
      if (cnt[i][y[0] - 'a'][y[i] - 'a'] == 1) cnt2[i][y[0] - 'a']++;
  for (int(i) = 0; (i) < (26); (i)++) {
    int mx = 0;
    for (int(j) = 1; (j) <= (l - 1); (j)++) mx = max(mx, cnt2[j][i]);
    prob += mx;
  }
  printf("%.9f\n", prob / l);
  return 0;
}
