#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, tmp, sum, ans, cnt[26];
string s;
vector<int> pos[26];
int main() {
  cin >> s;
  n = s.size();
  s += s;
  for (i = 0; i < n; ++i) {
    pos[s[i] - 'a'].push_back(i);
  }
  for (i = 0; i < 26; ++i) {
    sum = 0;
    for (j = 1; j < n; ++j) {
      tmp = 0;
      memset(cnt, 0, sizeof(cnt));
      for (int p : pos[i]) {
        cnt[s[p + j] - 'a']++;
      }
      for (k = 0; k < 26; ++k) {
        tmp += (cnt[k] == 1);
      }
      sum = max(sum, tmp);
    }
    ans += sum;
  }
  cout << fixed << setprecision(9) << ans * 1.0 / n << endl;
  return 0;
}
