#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using STR = string;
using CAR = char;
int main() {
  STR s;
  cin >> s;
  int n = s.size();
  vector<vector<vector<int>>> ma(26,
                                 vector<vector<int>>(26, vector<int>(n, 0)));
  for (int i = 0; i < n; ++i) {
    CAR a = s[i];
    for (int j = 0; j < n; ++j) {
      CAR b = s[(i + j) % n];
      ma[a - 'a'][b - 'a'][j]++;
    }
  }
  vector<double> is_ok(26, 0);
  for (int c = 0; c < 26; ++c) {
    vector<int> solo(n, 0), multi(n, 0);
    for (int lett = 0; lett < 26; ++lett)
      for (int i = 0; i < n; ++i)
        if (ma[c][lett][i] == 1)
          solo[i]++;
        else
          multi[i] += ma[c][lett][i];
    double maxi = 0.;
    for (int i = 0; i < n; ++i)
      maxi = max(maxi, ((double)solo[i]) / ((double)(solo[i] + multi[i])));
    is_ok[c] = maxi;
  }
  double cnt = 0;
  for (CAR c : s) cnt += is_ok[c - 'a'];
  cout << setprecision(12) << ((double)cnt) / ((double)n);
}
