#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
bool Finish_read;
template <class T>
inline void read(T &x) {
  Finish_read = 0;
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    if (ch == EOF) return;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
  Finish_read = 1;
}
template <class T>
inline void print(T x) {
  if (x / 10 != 0) print(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void writeln(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
  putchar('\n');
}
template <class T>
inline void write(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
}
string s;
int w[5005][26][26], ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) w[j][s[i] - 'a'][s[(i + j) % n] - 'a']++;
  for (int i = 0; i < 26; i++) {
    int mx = 0;
    for (int j = 0; j < n; j++) {
      int o = 0;
      for (int k = 0; k < 26; k++)
        if (w[j][i][k] == 1) o++;
      mx = max(mx, o);
    }
    ans += mx;
  }
  printf("%.15f\n", (double)ans / n);
}
