S = input() from collections import defaultdict d = defaultdict(int) ans = 0 for s in S: for u in d: if u == s:continue v = d[u] ans += v * (v - 1) // 2 d[s] += 1 print(ans)