#include <bits/stdc++.h>
using namespace std;
const int N = 5010, mod = int(1e9) + 7;
string second, t[N];
int n;
int cnt[30][30], cr[30], mx[30], rr[30];
string shift(int k) {
  string t;
  for (int i = k; i < n; i++) {
    t += second[i];
  }
  for (int i = 0; i < k; i++) {
    t += second[i];
  }
  return t;
}
int main() {
  cin >> second;
  n = second.size();
  for (int i = 0; i < n; i++) {
    t[i] = shift(i);
    rr[second[i] - 'a']++;
  }
  double ans = 0.0;
  for (int j = 0; j < n; j++) {
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < n; i++) {
      cnt[t[i][0] - 'a'][t[i][j] - 'a']++;
    }
    memset(cr, 0, sizeof(cr));
    for (int a = 0; a < 26; a++) {
      for (int b = 0; b < 26; b++) {
        if (cnt[a][b] == 1) {
          cr[a]++;
        }
      }
      mx[a] = max(mx[a], cr[a]);
    }
  }
  for (int i = 0; i < 26; i++) {
    ans += (mx[i] + 0.0);
  }
  printf("%.12lf", ans / n);
  return 0;
}
