#include <bits/stdc++.h>
const int kN = 5000 + 5;
char s[kN];
int n;
std::vector<int> vec[26];
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; ++i) vec[s[i] - 'a'].emplace_back(i);
  int total = 0;
  for (int c = 0; c < 26; ++c) {
    int max_t = 0;
    for (int i = 1; i < n; ++i) {
      int cnt[26] = {};
      for (int p : vec[c]) cnt[s[(p + i) % n] - 'a']++;
      int t = 0;
      for (int j = 0; j < 26; ++j) t += cnt[j] == 1;
      max_t = std::max(max_t, t);
    }
    total += max_t;
  }
  printf("%.10f\n", static_cast<double>(total) / n);
}
