#include <bits/stdc++.h>
using namespace std;
const int maxn = 10005;
int a[26][26][maxn];
char s[maxn];
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> s;
  n = strlen(s);
  for (int i = n; i < 2 * n - 1; ++i) {
    s[i] = s[i - n];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 1; j < n; ++j) {
      a[s[i] - 'a'][s[i + j] - 'a'][j]++;
    }
  }
  int res = 0;
  for (int i = 0; i < 26; ++i) {
    int c = 0;
    for (int j = 1; j < n; ++j) {
      int t = 0;
      for (int k = 0; k < n; ++k) {
        if (s[k] == 'a' + i) {
          if (a[s[k] - 'a'][s[j + k] - 'a'][j] == 1) {
            ++t;
          }
        }
      }
      c = max(c, t);
    }
    res += c;
  }
  cout << (double)res / n << endl;
  return 0;
}
