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>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
inline void solve();
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string digits = "0123456789";
void solve() {
  vector<long long> ind[30];
  string s;
  cin >> s;
  long long n = s.length();
  for (long long i = 0; i < n; i++) ind[s[i] - 'a'].push_back(i);
  double ans = 0;
  s = s + s;
  for (long long i = 0; i < 26; i++) {
    for (long long len = 1; len < n; len++) {
      bool c[30] = {0};
      for (long long l = 0; l < ind[i].size(); l++) {
        c[s[ind[i][l] + len] - 'a'] = true;
      }
      long long cnt = 0;
      for (long long j = 0; j < 30; j++)
        if (c[j]) cnt++;
      if (cnt == ind[i].size()) {
        ans += cnt * 1. / n;
        break;
      }
    }
  }
  cout << setprecision(15) << fixed << ans;
}
