#include <bits/stdc++.h>
using namespace std;
vector<int> V[26];
int win[26];
int main() {
  string a;
  cin >> a;
  double n = a.length();
  for (int i = 0; i < a.length(); ++i) {
    V[a[i] - 'a'].push_back(i);
  }
  for (int i = 0; i < 26; ++i) {
    if ((int)V[i].size() == 1)
      win[i] = 1;
    else if ((int)V[i].size() == 0)
      continue;
    else {
      int ans = 0;
      int cnt2 = 0;
      for (int j = 0; j < n; ++j) {
        vector<int> VV;
        for (int q = 0; q < (int)V[i].size(); ++q) {
          int ind = (V[i][q] + j) % (a.length());
          VV.push_back(a[ind]);
        }
        sort(VV.begin(), VV.end());
        for (int q = 0; q < (int)VV.size(); ++q) {
          int cnt = 0;
          while ((q + 1) < (int)VV.size() && VV[q] == VV[q + 1]) {
            cnt++;
            q++;
          }
          if (cnt == 0) cnt2++;
        }
        ans = max(ans, cnt2);
        cnt2 = 0;
      }
      win[i] = ans;
    }
  }
  int cnt = 0;
  for (int i = 0; i < 26; ++i) {
    cnt += win[i];
  }
  cout << fixed;
  cout.precision(9);
  cout << (double)cnt / n;
  return 0;
}
