s = input() l = len(s) m = [0] * l m[-1] = 1 t = 1 # 直前の文字の種類数 for i in range(l - 2, -1, -1): if not s[i] in s[i + 1: l]: t += 1 m[i] = t x = 0 for i in range(l): x += m[i] * (i + 1) print(2 * x / (l + l * l))