#include <bits/stdc++.h>
static const int Size = 256;
int main(int argc, const char* argv[]) {
  std::string s;
  std::cin >> s;
  int length = (int)(s.length());
  std::vector<std::vector<char>> v(length);
  for (int i = 0; i < length; i++) v[i].resize(length);
  for (int i = 0; i < length; i++) {
    for (int j = 1; j < length; j++) {
      int index = (i + j) % length;
      v[i][j - 1] = s[index];
    }
  }
  std::vector<int> counts(Size);
  for (int i = 0; i < length; i++) counts[s[i]]++;
  std::vector<int> r(Size);
  for (char c = 'a'; c <= 'z'; c++) {
    if (counts[c] == 0) continue;
    for (int i = 0; i < length - 1; i++) {
      std::vector<int> letters(Size);
      for (int j = 0; j < length; j++) {
        if (s[j] != c) continue;
        letters[v[j][i]]++;
      }
      int count = 0;
      for (char p = 'a'; p <= 'z'; p++)
        if (letters[p] == 1) count++;
      r[c] = std::max(r[c], count);
    }
  }
  int tolal = 0;
  for (char c = 'a'; c <= 'z'; c++) tolal += r[c];
  std::cout.precision(12);
  std::cout.flags(std::ios::fixed);
  std::cout << (double)tolal / length << std::endl;
  return 0;
}
