import collections s=input() n=len(s) dp=[0]*(n+1) dic=collections.defaultdict(int) for i,S in enumerate(s,1): dp[i]=dp[i-1]+i-dic[S] dic[S]=i-dic[S] print(sum(dp)/(n*(n+1)//2))