#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
char s[MAXN];
int len, cnt[26], num[26];
vector<int> ve[26];
double ans;
void work(int x) {
  int mx = 0;
  for (int i = 1; i < len; i++) {
    memset(num, 0, sizeof(num));
    for (int j = 0; j < cnt[x]; j++) {
      num[s[(ve[x][j] + i) % len] - 'a']++;
    }
    int tmp = 0;
    for (int j = 0; j < 26; j++) {
      if (num[j] == 1) tmp++;
    }
    mx = max(mx, tmp);
  }
  ans += 1.0 * mx / len;
}
int main() {
  scanf("%s", s);
  len = strlen(s);
  for (int i = 0; i < len; i++) {
    ve[s[i] - 'a'].push_back(i);
  }
  ans = 0;
  for (int i = 0; i < 26; i++) {
    cnt[i] = ve[i].size();
    if (cnt[i] > 0) work(i);
  }
  printf("%.12f\n", ans);
}
