#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<char> v[n];
  vector<int> m[30];
  vector<char> c;
  int arr[130];
  memset(arr, 0, sizeof(arr));
  for (int i = 0; i < n; i++) {
    int z = s[i];
    m[z - 97].push_back(i);
    if (arr[z] == 0) {
      c.push_back(s[i]);
      arr[z] = 1;
    }
    for (int j = 0; j < n; j++) {
      int x = (i + j + 1) % n;
      v[i].push_back(s[x]);
    }
  }
  vector<int> ans;
  double x = 0;
  for (int i = 0; i < c.size(); i++) {
    int z = c[i];
    z = z - 97;
    int ma = 0;
    for (int j = 0; j < n - 1; j++) {
      int a[30];
      int sum = 0;
      memset(a, 0, sizeof(a));
      int flag = 0;
      for (int k = 0; k < m[z].size(); k++) {
        a[v[j][m[z][k]] - 96]++;
      }
      for (int k = 0; k < 30; k++) {
        if (a[k] == 1) sum += 1;
      }
      if (ma < sum) ma = sum;
    }
    x = x + (double)ma / s.size();
  }
  printf("%.7lf\n", x);
}
