#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
vector<vector<int>> g(MAXN);
vector<vector<int>> f(MAXN);
vector<int> p(MAXN);
void dfs(int v, int fl) {
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    f[fl + 1].push_back(to);
    dfs(to, fl + 1);
  }
}
void read(vector<int> &a) {
  for (int i = 0; i < a.size(); i++) {
    cin >> a[i];
  }
}
void write(vector<int> &a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << ' ';
  }
  cout << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  vector<vector<vector<int>>> a(26);
  vector<long double> prob(26, 0), b(26, 0);
  cin >> s;
  int n = s.size();
  for (int i = 0; i < 26; i++) {
    a[i].resize(n);
    for (int j = 0; j < n; j++) {
      a[i][j].assign(26, 0);
    }
  }
  for (int i = 0; i < n; i++) {
    int cur = int(s[i] - 'a');
    prob[cur]++;
    for (int j = 1; j < n; j++) {
      int ind = int(s[(i + j) % n] - 'a');
      if (a[cur][j][ind] < 2) {
        a[cur][j][ind]++;
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 1; j < n; j++) {
      long double cur = 0;
      for (int k = 0; k < 26; k++) {
        if (a[i][j][k] == 1) {
          cur = cur + 1;
        }
      }
      b[i] = max(b[i], cur);
    }
  }
  long double ans = 0;
  for (int i = 0; i < 26; i++) {
    ans += (long double)b[i] / n;
  }
  cout << ans << endl;
}
