alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] s = input() n = len(s) ans = 0.0 all_num = n * (n + 1) // 2 for i in range(26): res = 0 cnt = 0 for j in range(n): if s[j] == alph[i]: res += cnt * (cnt + 1) // 2 cnt = 0 else: cnt += 1 res += cnt * (cnt + 1) // 2 ans += (all_num - res) / all_num print(ans)