#include <bits/stdc++.h>
using namespace std;
int main() {
  int len, i, j, k;
  float ans1 = 0, len1;
  char ch[5001];
  scanf("%s", ch);
  len = strlen(ch);
  vector<int> v[26];
  int ans[26][len + 1];
  for (i = 0; i < len; i++) v[ch[i] - 97].push_back(i);
  for (i = 0; i < 26; i++) {
    for (j = 1; j <= len; j++) ans[i][j] = 0;
  }
  for (i = 0; i < 26; i++) {
    for (j = 1; j <= len; j++) {
      int vis[26] = {0};
      for (k = 0; k < v[i].size(); k++) vis[ch[(v[i][k] + j) % len] - 97]++;
      for (k = 0; k < v[i].size(); k++) {
        if (vis[ch[(v[i][k] + j) % len] - 97] == 1) ans[i][j]++;
      }
    }
  }
  ans1 = 0;
  for (i = 0; i < 26; i++) {
    k = 0;
    for (j = 1; j <= len; j++) {
      if (ans[i][j] > k) k = ans[i][j];
    }
    ans1 += k;
  }
  len1 = len;
  printf("%f", ans1 / len1);
  return 0;
}
