#include <bits/stdc++.h>
using namespace std;
template <class T>
bool cmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool cmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int N = 5555;
int n;
char s[N];
int uniq[N];
vector<int> id[26];
int first[26];
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; i++) {
    id[s[i] - 'a'].push_back(i);
  }
  int ans = 0;
  for (int a = 0; a < 26; a++) {
    int mx = 0;
    for (int i = 0; i < n; i++) {
      memset(first, -1, sizeof first);
      for (int x : id[a]) {
        int c = s[(x + i) % n] - 'a';
        if (first[c] == -1) {
          first[c] = x;
        } else {
          first[c] = -2;
        }
      }
      int cnt = 0;
      for (int j = 0; j < 26; j++)
        if (first[j] >= 0) cnt++;
      cmax(mx, cnt);
    }
    ans += mx;
  }
  printf("%.10f\n", ans * 1.0 / n);
  return 0;
}
