#include <bits/stdc++.h>
const long long inf = 0x3f3f3f3f3f3f3f3LL;
const long long mod = (long long)1e9 + 7;
using namespace std;
template <class T>
void smin(T& a, T val) {
  if (a > val) a = val;
}
template <class T>
void smax(T& a, T val) {
  if (a < val) a = val;
}
const long long N = 5 * (long long)1e3 + 10;
long long power(long long a, long long b, long long m = mod) {
  a %= m;
  if (b < 0) b += m - 1;
  long long r = 1;
  while (b) {
    if (b & 1) r = (r * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return r;
}
const long long M = 26;
long long d[N][M][M];
void solve() {
  string s;
  cin >> s;
  long long n = (long long)(s.size());
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < n; ++j) {
      if (i == j) continue;
      long long dist = (j - i + n) % n;
      d[dist][s[i] - 'a'][s[j] - 'a']++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < M; ++i) {
    long long bst = 0;
    for (long long dist = 1; dist < n; ++dist) {
      long long curr = 0;
      for (long long j = 0; j < M; ++j) {
        if (d[dist][i][j] == 1) curr++;
      }
      smax(bst, curr);
    }
    ans += bst;
  }
  cout << fixed << setprecision(15);
  cout << ans / (long double)n;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
