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>
static const int Size = 256;
int main(int argc, const char* argv[]) {
  std::string s;
  std::cin >> s;
  int length = (int)(s.length());
  std::vector<std::vector<char>> v(Size);
  for (int i = 0; i < Size; i++) v[i].resize(length);
  std::vector<int> counts(Size);
  for (int i = 0; i < length; i++) counts[s[i]]++;
  for (int i = 0; i < length; i++) {
    for (int j = 1; j < length; j++) {
      int index = (i + j) % length;
      if (v[s[i]][j] == 0)
        v[s[i]][j] = s[index];
      else if (v[s[i]][j] == s[index])
        v[s[i]][j] = -1;
      else if (v[s[i]][j] != -1)
        v[s[i]][j] = s[index];
    }
  }
  double count = 0;
  for (char c = 'a'; c <= 'z'; c++) {
    bool flag = false;
    for (int i = 0; i < length - 1; i++) {
      if (v[c][i] > 0) {
        flag = true;
        break;
      }
    }
    if (flag) {
      if (counts[c] == 2)
        count += 2;
      else
        count++;
    }
  }
  std::cout.precision(12);
  std::cout.flags(std::ios::fixed);
  std::cout << count / length << std::endl;
  return 0;
}
