#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long double PI = 4 * atan(1);
int ans, tmp[26], flag, n, cur;
string second;
vector<int> v[26];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> second;
  n = second.length();
  for (int i = 0; i < second.length(); i++) {
    v[(int)(second[i] - 'a')].push_back(i);
  }
  second += second;
  for (int i = 0; i < 26; i++) {
    if (v[i].size() == 0) continue;
    if (v[i].size() == 1) {
      ans++;
      continue;
    }
    cur = 0;
    for (int j = 1; j < n; j++) {
      flag = 0;
      for (int k = 0; k < 26; k++) tmp[k] = 0;
      for (int k = 0; k < v[i].size(); k++) {
        tmp[(int)(second[v[i][k] + j] - 'a')]++;
      }
      for (int k = 0; k < 26; k++)
        if (tmp[k] == 1) flag++;
      cur = max(cur, flag);
    }
    ans += cur;
  }
  long double x = ans, y = n;
  cout << fixed << setprecision(6) << x / y;
  return 0;
}
