#include <bits/stdc++.h>
using namespace std;
int Add(int &a, int b) { a = (a + b) % 1000000007; }
int Min(int &a, int b) { a = (a + 1000000007 - b) % 1000000007; }
int Mul(int &a, int b) { a = (long long)a * b % 1000000007; }
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long pow(long long a, long long b) {
  long long res(1);
  while (b) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    b >>= 1;
  }
  return res;
}
long long powM(long long a, long long b, long long mod) {
  long long res(1);
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
const int infi = 2147483647;
const long long infl = 9223372036854775807;
int n, m, k, T;
char s[5011];
int p[26][5011];
int vis[26];
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < (n); ++i) {
    int idx = s[i] - 'a';
    p[idx][++p[idx][0]] = i;
  }
  int ans = 0;
  for (int k = 0; k < (26); ++k) {
    int num = 0;
    for (int i = 1; i <= (n); ++i) {
      memset(vis, 0, sizeof vis);
      int ok = 1;
      for (int j = 1; j <= (p[k][0]); ++j) {
        int tmp = (p[k][j] + i) % n;
        int idx = s[tmp] - 'a';
        vis[idx]++;
      }
      int x = 0;
      for (int j = 0; j < (26); ++j) x += vis[j] == 1;
      num = max(num, x);
    }
    ans += num;
  }
  printf("%f\n", ans * 1.0 / n);
  return 0;
}
