#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e18;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long indice, tindice, tb, xx, yy, dones, done, mind, deb, fin, indx,
    valarrows, n, m, k, x, y, z, a, b, c, nb, q, cur, res;
string s;
long long dp[26][5005][26];
void solve() {
  cin >> s;
  n = s.length();
  for (int i = 0; i < n; ++i) {
    for (int j = 1; j < n; ++j) {
      dp[s[i] - 'a'][j][s[(i + j) % n] - 'a']++;
    }
  }
  int cnt = 0;
  for (int i = 0; i < 26; ++i) {
    int mx = 0;
    for (int j = 1; j < n; ++j) {
      int ok = 0;
      for (int k = 0; k < 26; ++k) {
        if (dp[i][j][k] == 1) {
          ok++;
        }
      }
      mx = max(mx, ok);
    }
    cnt += mx;
  }
  cout << fixed << setprecision(10) << (double)cnt / n;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
