# import sys; input = sys.stdin.buffer.readline # sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): S = input() N = len(S) pre = [-1] * 26 minus = 0 for i in range(N): a = ord(S[i]) - 97 num = i - pre[a] - 1 minus += int(num * (num + 1) // 2) pre[a] = i for i in range(26): minus += int((N - 1 - pre[i]) * (N - pre[i]) // 2) # print(minus) ans = 26 - minus / (int(N * (N + 1) // 2)) print(ans) if __name__ == '__main__': main()