#include <bits/stdc++.h>
struct Arrete {
  int v, c;
};
struct Point {
  int x, y;
  double distance(Point other) const {
    return sqrt((x - other.x) * (x - other.x) + (y - other.y) * (y - other.y));
  }
};
std::string s;
int occu[26] = {};
std::list<int> pos[26];
double best_p(int letter) {
  int cnt[26];
  int max(0);
  for (int i(0); i < s.size(); ++i) {
    for (int i(0); i < 26; ++i) cnt[i] = 0;
    for (auto v : pos[letter]) cnt[s[(v + i) % s.size()] - 'a']++;
    int cur(0);
    for (int k(0); k < 26; ++k) cur += cnt[k] == 1;
    max = std::max(cur, max);
  }
  return max;
}
int main(void) {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::cin >> s;
  for (int i(0); i < s.size(); ++i)
    occu[s[i] - 'a']++, pos[s[i] - 'a'].push_back(i);
  double p = 0.0;
  for (int i(0); i < 26; ++i) {
    if (occu[i] == 0) continue;
    p += best_p(i) / s.size();
  }
  std::cout << std::setprecision(12) << std::fixed << p << std::endl;
}
