#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
char t[maxn], txt[maxn][maxn];
int n, a[maxn];
int vis[maxn][30];
double ans;
void work(char p) {
  int len = 0;
  for (int i = 1; i <= n; i++) {
    if (t[i] == p) {
      len++;
      int sz = 0;
      for (int j = i; j <= n; j++) txt[len][++sz] = t[j];
      for (int j = 1; j < i; j++) txt[len][++sz] = t[j];
    }
  }
  memset(vis, 0, sizeof(vis));
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= len; i++)
    for (int j = 2; j <= n; j++) vis[j][txt[i][j] - 'a']++;
  for (int i = 1; i <= len; i++) {
    for (int j = 2; j <= n; j++) {
      if (vis[j][txt[i][j] - 'a'] == 1) {
        a[j]++;
      }
    }
  }
  int mx = 0;
  for (int i = 2; i <= n; i++) mx = max(mx, a[i]);
  ans += 1.0 * mx / n;
}
int main() {
  scanf("%s", t + 1);
  n = strlen(t + 1);
  for (int i = 0; i < 26; i++) work('a' + i);
  printf("%.10lf\n", ans);
  return 0;
}
