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 INF = 2147483647;
const long long INFL = 9223372036854775807LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;
int cnt[26];
int crit_count[26][5000 + 5][26];
int wins[26][5000 + 5];
int32_t main() {
  string s;
  cin >> s;
  int n = s.length();
  memset(cnt, 0, sizeof(cnt));
  ;
  memset(crit_count, 0, sizeof(crit_count));
  ;
  memset(wins, 0, sizeof(wins));
  ;
  for (int i = 0; i < n; i++) {
    int c1 = s[i] - 'a';
    cnt[c1]++;
    for (int j = 0; j < n; j++) {
      int c2 = s[(i + j) % n] - 'a';
      crit_count[c1][j][c2]++;
    }
  }
  for (int i = 0; i < n; i++) {
    int c1 = s[i] - 'a';
    for (int j = 0; j < n; j++) {
      int c2 = s[(i + j) % n] - 'a';
      int x = crit_count[c1][j][c2];
      if (x == 1) {
        wins[c1][j]++;
      }
    }
  }
  double ans = 0;
  for (int c = 0; c < 26; c++) {
    int max_guess = 0;
    for (int i = 0; i < n; i++)
      max_guess = ((max_guess) > (wins[c][i]) ? (max_guess) : (wins[c][i]));
    ans += (double)max_guess / (double)n;
  }
  printf("%.9f\n", ans);
  return 0;
}
