#include <bits/stdc++.h>
using namespace std;
constexpr long long INF = 0x3FFFFFFFFFFFFFFF;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  map<char, vector<long long>> pos;
  for (long long i = 0; i < s.size(); i++) {
    pos[s[i]].push_back(i);
  }
  double res = 0;
  for (auto e : pos) {
    double probChar = (double)e.second.size() / s.size();
    double probMax = 0.0;
    for (long long j = 1; j < s.size(); j++) {
      map<char, long long> count;
      for (long long i : e.second) {
        count[s[(i + j) % s.size()]]++;
      }
      long long uniques = 0;
      for (auto e2 : count) {
        if (e2.second == 1) {
          uniques++;
        }
      }
      probMax = max(probMax, (double)uniques / e.second.size());
    }
    res += probChar * probMax;
  }
  cout << setprecision(20) << res << endl;
}
