#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 5e3 + 5;
int n, vis[26][26][N];
string s;
long double ans;
int main() {
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) vis[s[0] - 'a'][s[j] - 'a'][j]++;
    s.push_back(s.front());
    s.erase(s.begin());
  }
  for (int i = 0; i < 26; i++) {
    int mx = 0;
    for (int j = 0; j < n; j++) {
      int cnt = 0;
      for (int k = 0; k < 26; k++) {
        cnt += (vis[i][k][j] == 1);
      }
      mx = max(mx, cnt);
    }
    ans += mx;
  }
  cout << ans / (long double)n;
  return 0;
}
