#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int cnt[26][N][26], tot[N];
int id(char c) { return c - 'a'; }
int main() {
  string s;
  cin >> s;
  int n = s.length();
  s = s + s;
  for (int i = 0; i < n; i++) {
    int c = 0;
    tot[id(s[i])]++;
    for (int j = i; j < i + n; j++) {
      cnt[id(s[i])][c][id(s[j])]++;
      c++;
    }
  }
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    int mx = 0;
    for (int j = 0; j < n; j++) {
      int c = 0;
      for (int k = 0; k < 26; k++) {
        if (cnt[i][j][k] == 1) c++;
      }
      mx = max(mx, c);
    }
    ans += mx;
  }
  printf("%.8f", 1.0 * ans / n);
  return 0;
}
