#include <bits/stdc++.h>
using namespace std;
inline void read(long long &x) {
  char ch;
  bool flag = false;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') flag = true;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  x = flag ? -x : x;
}
inline void read(int &x) {
  char ch;
  bool flag = false;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') flag = true;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  x = flag ? -x : x;
}
inline void write(long long x) {
  static const long long maxlen = 100;
  static char s[maxlen];
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (!x) {
    putchar('0');
    return;
  }
  long long len = 0;
  for (; x; x /= 10) s[len++] = x % 10 + '0';
  for (long long i = len - 1; i >= 0; --i) putchar(s[i]);
}
char s[6000];
int a[6000];
int g[30];
int can[30][30][6000];
int num[30];
int f[30];
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) a[i] = s[i] - 'a' + 1;
  for (int i = 0; i < len; i++) num[a[i]]++;
  for (int i = 0; i < len; i++) {
    memset(g, 0, sizeof(g));
    for (int j = 1; j < len; j++) can[a[i]][a[(i + j) % len]][j]++;
  }
  int sum = 0;
  for (int i = 1; i <= 26; i++) {
    f[i] = 0;
    for (int j = 1; j < len; j++) {
      int cnt = 0;
      for (int k = 1; k <= 26; k++)
        if (can[i][k][j] == 1) cnt++;
      f[i] = max(f[i], cnt);
    }
    sum = sum + f[i];
  }
  double ans = 1.0 * sum / len;
  printf("%.13f\n", ans);
  return 0;
}
