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>
const long long N = 5007;
using namespace std;
string s;
vector<string> pal;
void calc_pal() {
  string cur = s;
  long long idx = 0;
  do {
    pal.push_back(cur);
    idx++;
    cur = "";
    for (long long i = idx; i < s.size(); i++) cur.push_back(s[i]);
    for (long long i = 0; i < idx; i++) cur.push_back(s[i]);
  } while (idx < s.size());
}
void read() {
  cin >> s;
  if (s.size() == 1) {
    cout << "1.0000000000" << endl;
    exit(0);
  }
}
long long ar[30][N][30];
void calc_ar() {
  for (auto cur : pal)
    for (long long i = 0; i < cur.size(); i++)
      ar[cur[0] - 'a'][i][cur[i] - 'a']++;
}
long long wins = 0;
void calc_wins() {
  for (long long i = 0; i < 26; i++) {
    long long ans = 0;
    for (long long j = 0; j < s.size(); j++) {
      long long pr = 0;
      for (long long q = 0; q < 26; q++) pr += (ar[i][j][q] == 1);
      ans = max(pr, ans);
    }
    wins += ans;
  }
}
long double solve() {
  calc_pal();
  calc_ar();
  calc_wins();
  return (((long double)(wins)) / ((long double)(s.size())));
}
int32_t main() {
  read();
  cout.precision(15);
  cout << fixed << solve() << endl;
}
