from string import ascii_lowercase as X S=input() N=len(S) R={x:0 for x in X} A=0 for i,s in enumerate(S,1): R[s]=i A+=sum(R.values()) print(A/(N*(N+1)//2))