#include <bits/stdc++.h>
using namespace std;
void smain();
int main() {
  ios_base::sync_with_stdio(0);
  smain();
  return 0;
}
long long n;
long long d[26][5005][26];
void smain() {
  string s;
  for (; cin >> s;) {
    n = s.length();
    for (long long i = 0; i < n; i++) {
      rotate(s.begin(), s.begin() + 1, s.end());
      long long t = s.front() - 'a';
      for (long long j = 0; j < n; j++) d[t][j][s[j] - 'a'] += 1;
    }
    long long res = 0;
    for (long long t = 0; t < 26; t++) {
      long long p = 0;
      for (long long j = 0; j < n; j++) {
        long long c = 0;
        for (long long k = 0; k < 26; k++)
          if (d[t][j][k] == 1) c += 1;
        p = max(c, p);
      }
      res += p;
    }
    cout.precision(9);
    cout << fixed << (double)res / n << '\n';
  }
}
