S = input() n = len(S) bef = [0] * 26 ans = 0 for i, s in enumerate(S, 1): p = ord(s) - 97 bef[p] = i ans += sum(bef) print(ans / (n * (n + 1) // 2))