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 long long MAXN = 1123456;
template <typename T>
T sqr(T x) {
  return x * x;
}
template <typename T>
void vout(T s) {
  cout << s << "\n";
  exit(0);
}
long long bp(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n % 2) res *= a;
    a *= a;
    n >>= 1;
  }
  return res;
}
vector<long long> v[MAXN], v1[MAXN], va;
string s1, s2, s3;
set<long long> s;
char cc;
long long a[MAXN], b[MAXN], c[MAXN], a1, b1, c1, i, j, n, m, k, ans, sc, x;
long long stn;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> s1;
  n = s1.size();
  ans = 0;
  for (i = 0; i < n; i++) {
    x = s1[i] - 'a';
    v[x].push_back(i);
    v1[x].push_back(i);
  }
  for (i = 0; i < 26; i++)
    if (v[i].size()) {
      for (j = 0; j < n; j++) c[j] = 0;
      j = 1;
      long long nn = v[i].size();
      while (j < n) {
        s.clear();
        for (long long i1 = 0; i1 < nn; i1++) {
          v[i][i1]++;
          if (v[i][i1] == n) v[i][i1] = 0;
        }
        for (long long i1 = 0; i1 < nn; i1++) {
          b[s1[v[i][i1]] - 'a']++;
        }
        for (long long i1 = 0; i1 < nn; i1++) {
          x = v[i][i1];
          if (b[s1[x] - 'a'] == 1) c[j]++;
          b[s1[x] - 'a'] = 0;
        }
        j++;
      }
      sc = 0;
      for (j = 0; j < n; j++) sc = max(sc, c[j]);
      ans += sc;
    }
  double ke = n;
  cout << fixed << setprecision(7) << ans / ke << "\n";
  return 0;
}
