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 N = 5e3;
int n, len;
char str[N + 10];
char ss[N + 10];
bool have[26];
vector<string> arr[26];
void merge(char *s, int t) {
  int top = 0;
  for (int i = t; i < len; i++) s[top++] = str[i];
  for (int i = 0; i < t; i++) s[top++] = str[i];
  s[top] = '\0';
}
int main() {
  while (~scanf("%s", str)) {
    memset(have, 0, sizeof(have));
    for (int i = 0; i < 26; i++) arr[i].clear();
    len = 0;
    for (int i = 0; str[i] != '\0'; i++) {
      len++;
      have[str[i] - 'a'] = true;
    }
    int top = 0;
    for (int i = 0; i < 26; i++)
      if (have[i]) {
        char c = 'a' + i;
        for (int j = 0; j < len; j++) {
          if (str[j] == c) {
            merge(ss, j);
            arr[top].push_back(string(ss));
          }
        }
        top++;
      }
    double ans = 0;
    for (int i = 0; i < top; i++) {
      int len1 = arr[i].size();
      int maxt = 0;
      for (int j = 1; j < len; j++) {
        int cnt[26];
        memset(cnt, 0, sizeof(cnt));
        int tt = 0;
        for (int k = 0; k < len1; k++) {
          char tp = arr[i][k][j] - 'a';
          cnt[tp]++;
        }
        for (int k = 0; k < 26; k++)
          if (cnt[k] == 1) tt++;
        maxt = max(maxt, tt);
      }
      ans += (double)maxt;
    }
    double p = ans / len;
    printf("%.13f\n", p);
  }
  return 0;
}
