#include <bits/stdc++.h>
using namespace std;
int cnt[26][26][5011], n, buc[26];
char s[5011];
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      ++cnt[s[j] - 'a'][s[(j + i) % n] - 'a'][i];
    }
  }
  for (int i = 0; i < n; ++i) ++buc[s[i] - 'a'];
  int ans = 0;
  for (int i = 0; i < 26; ++i) {
    int win = 0;
    for (int j = 0; j < n; ++j) {
      int tmp = 0;
      for (int k = 0; k < 26; ++k) tmp += (cnt[i][k][j] == 1);
      win = max(win, tmp);
    }
    ans += win;
  }
  printf("%.8lf\n", (double)ans / n);
  return 0;
}
