#include <bits/stdc++.h>
using namespace std;
int read() {
  char c;
  int s = 0, t = 1;
  while (!isdigit(c = getchar()))
    if (c == '-') t = -1;
  do {
    s = s * 10 + c - '0';
  } while (isdigit(c = getchar()));
  return s * t;
}
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a < b ? b : a; }
int ab(int x) { return x > 0 ? x : -x; }
const int inf = 0x3f3f3f3f, maxn = 5010;
int n, a[maxn], ch[30], ans;
char s[maxn][maxn];
int solve(char c) {
  int tot = 0, mx = 0;
  for (int i = 0; i < n; i++)
    if (s[i][0] == c) a[++tot] = i;
  for (int j = 0; j < n; j++) {
    memset(ch, 0, sizeof(ch));
    for (int i = 1; i <= tot; i++) {
      ch[s[a[i]][j] - 'a']++;
    }
    int now = 0;
    for (int i = 0; i < 26; i++) now += (ch[i] == 1);
    mx = max(mx, now);
  }
  return mx;
}
char ss[maxn];
int main() {
  scanf("%s", ss);
  n = strlen(ss);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) s[i][j] = ss[(i + j) % n];
  }
  ans = 0;
  for (int i = 0; i < 26; i++) ans += solve('a' + i);
  printf("%.10lf", 1.0 * ans / n);
  return 0;
}
