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>
template <class t>
void maxi(t &x, t y) {
  if (x < y) x = y;
}
template <class t>
void mini(t &x, t y) {
  if (x > y) x = y;
}
using namespace std;
string s[5005], t;
int n, cnt[5005][5005];
void copy(int k) {
  s[k].resize(n);
  for (int(i) = 0; (i) < (n); (i)++) s[k][i] = t[(i + k) % n];
}
int main() {
  ios::sync_with_stdio(0);
  cout << setprecision(10) << fixed;
  cin >> t;
  n = t.size();
  for (int(i) = 0; (i) < (n); (i)++) copy(i);
  sort(s, s + n);
  int i = 0;
  int ans = 0;
  while (i < n) {
    int j = i;
    for (int(k) = 'a'; (k) <= ('z'); (k)++)
      for (int(i) = 1; (i) <= (n - 1); (i)++) cnt[k][i] = 0;
    while (j < n && s[j][0] == s[i][0]) {
      for (int(i) = 1; (i) <= (n - 1); (i)++) cnt[s[j][i]][i]++;
      j++;
    }
    j--;
    int check = false;
    for (int(i) = 1; (i) <= (n - 1); (i)++) {
      int x = 0;
      for (int(k) = 'a'; (k) <= ('z'); (k)++) x += cnt[k][i] == 1;
      maxi(check, x);
    }
    ans += check;
    i = j + 1;
  }
  cout << ans * 1.0 / n << endl;
  return 0;
}
