#include <bits/stdc++.h>
using namespace std;
int n;
int sum[26];
char str[5002];
char str_list[5002][5002];
int main() {
  double ans = 0.0;
  scanf("%s", str), n = strlen(str);
  for (int i = 0; i < 26; i++) {
    int cnt = 0;
    int max_total = 0;
    for (int j = 0; j < n; j++)
      if (str[j] == 'a' + i) {
        for (int k = j; k < n; k++) str_list[cnt][k - j] = str[k];
        for (int k = 0; k < j; k++) str_list[cnt][k + n - j] = str[k];
        cnt++;
      }
    for (int j = 1; j < n; j++) {
      int total = 0;
      for (int k = 0; k < 26; k++) sum[k] = 0;
      for (int k = 0; k < cnt; k++) sum[(int)(str_list[k][j] - 'a')]++;
      for (int k = 0; k < 26; k++)
        if (sum[k] == 1) total++;
      max_total = max(max_total, total);
    }
    ans += 1.0 * max_total / (1.0 * n);
  }
  printf("%.10lf\n", ans);
  return 0;
}
