#include <bits/stdc++.h>
using namespace std;
const int N = 50005;
string s;
int freq[30][30][N];
int main() {
  cin >> s;
  int n = s.size();
  s += s;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j <= i + n; j++)
      freq[s[i] - 'a'][s[j] - 'a'][j - i + 1]++;
  long long cs = 0;
  for (int i = 0; i < 26; i++) {
    int sum = 0;
    for (int k = 0; k <= n; k++) {
      int temp = 0;
      for (int j = 0; j < 26; j++) temp += freq[i][j][k] == 1;
      sum = max(temp, sum);
    }
    cs += sum;
  }
  cout << setprecision(9) << cs / (n + .0) << endl;
}
