#include <bits/stdc++.h>
using namespace std;
const int N = 5000 + 7, Log = 30, mod = (int)1e9 + 7;
inline void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}
inline int mul(int a, int b) {
  long long res = (long long)1ll * a * b;
  return res % mod;
}
inline int power(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
inline int inv(int a) { return power(a, mod - 2); }
string s;
int f[Log][N][Log];
int main() {
  cin >> s;
  string help = s + s;
  int n = (int)s.size();
  for (int i = 0; i < n; i++) {
    char start = s[i];
    int id = start - 'a';
    for (int j = 0; j < n; j++) {
      char second = help[i + j];
      f[id][j][second - 'a']++;
    }
  }
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    int mx = 0;
    for (int dist = 0; dist < n; dist++) {
      int x = 0;
      for (int j = 0; j < 26; j++) {
        if (f[i][dist][j] == 1) {
          x++;
        }
      }
      mx = max(mx, x);
    }
    ans += mx;
  }
  long double a = ans, b = n;
  long double belakhare = (long double)a / (long double)b;
  cout << fixed << setprecision(13) << belakhare << endl;
  return 0;
}
