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 MAXN = 5e3 + 10;
vector<string> arr['z' + 1];
int main() {
  cout.precision(20);
  cout << fixed;
  string s;
  cin >> s;
  int n = (int)s.size();
  for (int i = 0; i < n; i++) {
    string t;
    for (int j = i; j < n; j++) {
      t += s[j];
    }
    for (int j = 0; j < i; j++) {
      t += s[j];
    }
    arr[t[0]].push_back(t);
  }
  int ok = 0;
  for (char i = 'a'; i <= 'z'; i++) {
    if ((int)arr[i].size() != 0) {
      int ch = 0;
      for (int pos = 0; pos < n; pos++) {
        int cnt['z' + 1];
        for (char j = 'a'; j <= 'z'; j++) {
          cnt[j] = 0;
        }
        bool fl = true;
        for (int j = 0; j < arr[i].size(); j++) {
          if (cnt[arr[i][j][pos]] >= 1) {
            fl = false;
          }
          cnt[arr[i][j][pos]]++;
        }
        if (fl) {
          ok += ((int)arr[i].size());
          ch = 2;
          break;
        }
        for (char j = 'a'; j <= 'z'; j++) {
          if (cnt[j] == 1) {
            ch = 1;
            break;
          }
        }
      }
      if (ch == 1) {
        ok++;
      }
    }
  }
  cout << (double)((double)ok / (double)n);
}
