#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) {
      res = (res * x) % 1000000007;
    }
    x = (x * x) % 1000000007;
    y = y >> 1;
  }
  return res;
}
std::vector<int> divi[60004];
void divisor(int n) {
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j += i) {
      divi[j].push_back(i);
    }
  }
}
int a[100005];
int dp[100005];
int cnt[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  std::vector<int> v[26];
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i <= n - 1; i++) {
    v[s[i] - 'a'].push_back(i);
  }
  int cnt = 0, t = 0;
  for (int i = 0; i <= 25; i++) {
    if (v[i].size() > 0) t++;
  }
  std::vector<int> tt;
  double ans = 0.0;
  int f = 0;
  for (int i = 0; i <= 25; i++) {
    int k = 1;
    while (k < n && v[i].size() > 0) {
      for (int i = 0; i <= 25; i++) a[i] = 0;
      for (int j = 0; j <= v[i].size() - 1; j++) {
        int x = (v[i][j] + k) % n;
        a[s[x] - 'a']++;
      }
      k++;
      int x = 0;
      for (int i = 0; i <= 25; i++) {
        if (a[i] == 1) x++;
      }
      f = max(x, f);
    }
    ans = ans + (double)f / (double)n;
    f = 0;
  }
  printf("%.11lf", ans);
}
