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>
const int MAXN = 5005;
char str[MAXN];
int len;
bool vis[26];
double ans[26];
int buf_index[MAXN], cnt_buf;
int cnt[26];
int main() {
  scanf("%s", str);
  len = strlen(str);
  for (int i = 0; i < len; i++) str[i] -= 'a';
  for (int i = 0; i < len; i++)
    if (!vis[str[i]]) {
      vis[str[i]] = true;
      cnt_buf = 0;
      for (int j = i; j < len; j++)
        if (str[j] == str[i]) buf_index[cnt_buf++] = j;
      for (int j = 1; j < len; j++) {
        memset(cnt, 0, sizeof(cnt));
        for (int k = 0; k < cnt_buf; k++) cnt[str[(buf_index[k] + j) % len]]++;
        int cnt_1 = 0;
        for (int k = 0; k < 26; k++) {
          if (cnt[k] == 1) cnt_1++;
        }
        ans[str[i]] = std::max(ans[str[i]], (double)cnt_1 / cnt_buf);
      }
    }
  double sum = 0;
  for (int i = 0; i < len; i++) sum += ans[str[i]];
  printf("%f\n", sum / len);
  return 0;
}
