#include #define rep(i,n) for(int i=0;i ; const int INF = 1e9; const int MOD = 1000000007; int main(){ string s; cin >> s; ll n = s.size(); vector use(26,-1); vector dp(n,0); ll res = 0; rep(i,n){ if(i==0){ dp[i] = 1; use[s[i]-'a'] = i; }else{ dp[i] = dp[i-1] + i - use[s[i]-'a']; use[s[i]-'a'] = i; } res += dp[i]; } double ans = (double)(res)/(double)(n*(n+1)/2); printf("%.7f",ans); return 0; }