#include using namespace std; using ll = long long; ll calc(string& s, char c) { ll n = s.size(); ll res = n * (n + 1) / 2; ll cur = 0; for (ll i = 0; i < n; i++) { if (s[i] == c) { ll d = i - cur; res -= d * (d + 1) / 2; cur = i + 1; } } ll d = n - cur; res -= d * (d + 1) / 2; return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int n = s.size(); ll val1 = 0; for (int i = 0; i < 26; i++) { val1 += calc(s, 'a' + i); } ll val2 = n * (n + 1) / 2; cout << fixed << setprecision(15) << (long double)val1 / val2 << endl; return 0; }