#include <bits/stdc++.h>
using namespace std;
const int maxn = 27;
const int inf = INT_MAX;
const long long inff = 1e18;
const long long mod = 1e9 + 7;
int a[30];
int n;
string s;
vector<int> v[maxn];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  n = s.length();
  int ans = 0;
  for (int i = 0; i < n; i++) v[s[i] - 'a'].push_back(i);
  for (int i = 0; i < 26; i++) {
    int maxx = 0;
    for (int j = 1; j <= n - 1; j++) {
      memset(a, 0, sizeof(a));
      for (int k : v[i]) a[s[(k + j) % n] - 'a']++;
      int cnt = 0;
      for (int k = 0; k < 26; k++)
        if (a[k] == 1) cnt++;
      maxx = max(maxx, cnt);
    }
    ans += maxx;
  }
  cout << fixed << setprecision(15) << ans * 1.0 / n << '\n';
}
