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 = 5000;
vector<int> pos_letra[26];
char sig_letra[MAXN + 2][MAXN + 2];
string s;
int n;
bool gano(char c) {
  int idx = c - 'a';
  int tam = pos_letra[idx].size();
  for (int pasos = 1; pasos < n; pasos++) {
    set<char> conjunto;
    for (int i = 0; i < tam; i++) {
      conjunto.insert(sig_letra[pos_letra[idx][i]][pasos]);
    }
    if (conjunto.size() == tam) return true;
  }
  return false;
}
long double prob_letra(char c) {
  long double ret = pos_letra[c - 'a'].size();
  ret /= (long double)n;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    pos_letra[s[i] - 'a'].push_back(i);
    for (int j = 1; j < n; j++) {
      sig_letra[i][j] = s[(i + j) % n];
    }
  }
  long double resp = 0, aux;
  for (char i = 'a'; i <= 'z'; i++) {
    aux = 0;
    if (gano(i)) {
      aux = prob_letra(i);
    }
    resp += aux;
  }
  if (resp == 0) resp = (long double)1 / (long double)n;
  cout << setprecision(9) << fixed;
  cout << resp << "\n";
  return 0;
}
