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 main() {
  string s;
  int cnt[30] = {0};
  cin >> s;
  int n = s.length(), alph = 0;
  for (int i = 0; i < n; ++i) {
    cnt[s[i] - 'a']++;
    if (cnt[s[i] - 'a'] == 1) {
      ++alph;
    }
  }
  double ans = 0;
  for (char c = 'a'; c <= 'z'; ++c) {
    if (cnt[c - 'a'] == 1) {
      ans += 1;
      continue;
    }
    if (cnt[c - 'a'] == 0) {
      continue;
    }
    vector<int> idx;
    for (int i = 0; i < n; ++i) {
      if (s[i] == c) {
        idx.push_back(i);
      }
    }
    int f = 0;
    double best = 0;
    for (int i = 0; i < n; ++i) {
      int cnt2[30] = {0};
      for (int j = 0; j < idx.size(); ++j) {
        cnt2[s[(idx[j] + i) % n] - 'a']++;
      }
      int sum = 0;
      for (char j = 'a'; j <= 'z'; ++j) {
        sum += cnt2[j - 'a'] > 0;
      }
      int sum1 = 0;
      for (char j = 'a'; j <= 'z'; ++j) {
        sum1 += cnt2[j - 'a'] == 1;
      }
      for (char j = 'a'; j <= 'z'; ++j) {
        if (cnt2[j - 'a'] == 1) {
          best =
              max(best, cnt[c - 'a'] *
                            (sum == idx.size() ? 1 : 1.0 * sum1 / idx.size()));
        }
      }
    }
    ans += best;
  }
  cout << fixed << setprecision(10) << ans / n << '\n';
}
