from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline S = list(input())[:-1] S = [ord(s)-ord('A') for s in S] N = len(S) ans = 0 dp = [0]*26 for i in range(N): s = S[i] dp[s] += 1 for j in range(26): if j==s: continue ans += dp[j]*(dp[j]-1)//2 print(ans)