#include <bits/stdc++.h>
using namespace std;
int N, M, K;
void die() {
  printf("!");
  exit(0);
}
long long mod = 1e9 + 7;
int scnt[100];
double sprob[100];
int p[30][6000][30];
int main(void) {
  string s;
  cin >> s;
  for (int i = 0; i < (int)s.size(); i++) scnt[s[i] - 'a']++;
  for (int i = 0; i < 26; i++)
    sprob[i] = (double)1.0 * scnt[i] / (1.0 * (int)s.size());
  for (int i = 0; i < (int)s.size(); i++) {
    for (int j = 1; j < (int)s.size(); j++) {
      p[s[i] - 'a'][j][s[(i + j) % (int)s.size()] - 'a']++;
    }
  }
  double ans = 0.0;
  for (int i = 0; i < 26; i++) {
    double mx = 0.0;
    for (int d = 1; d < (int)s.size(); d++) {
      int total = 0;
      int cnt = 0;
      for (int j = 0; j < 26; j++) {
        total += p[i][d][j];
        if (p[i][d][j] == 1) cnt++;
      }
      if (total == 0) {
        continue;
      }
      double prob = (double)1.0 * cnt / (1.0 * total);
      mx = max(mx, prob);
    }
    ans += sprob[i] * mx;
  }
  printf("%.10f\n", ans);
}
