a=eval(input())

dic={}

for i in range(len(a)):

  s=a[i]

  if s in dic:

    dic[s]=dic[s]+1

  else:

    dic[s]=1



sum=0

for val in list(dic.values()):

  if val>1:

    sum=sum+(val-1)*val//2

  

print(((len(a)*(len(a)-1))//2-sum+1))
import sys

readline = sys.stdin.readline



A = readline().rstrip()



from collections import Counter

counter = Counter(A)



ans = 1 + (len(A) * (len(A) - 1)) // 2



for val in list(counter.values()):

  ans -= (val * (val - 1)) // 2

  

print(ans)
a = eval(input())
dic = {}
for i in range(len(a)):
    s = a[i]
    if s in dic:
        dic[s] = dic[s] + 1
    else:
        dic[s] = 1
sum = 0
for val in list(dic.values()):
    if val > 1:
        sum = sum + (val - 1) * val // 2
print(((len(a) * (len(a) - 1)) // 2 - sum + 1))

import sys

readline = sys.stdin.readline
A = readline().rstrip()
from collections import Counter

counter = Counter(A)
ans = 1 + (len(A) * (len(A) - 1)) // 2
for val in list(counter.values()):
    ans -= (val * (val - 1)) // 2
print(ans)

-a = eval(input()) -dic = {} -for i in range(len(a)): -    s = a[i] -    if s in dic: -        dic[s] = dic[s] + 1 -    else: -        dic[s] = 1 -sum = 0 -for val in list(dic.values()): -    if val > 1: -        sum = sum + (val - 1) * val // 2 -print(((len(a) * (len(a) - 1)) // 2 - sum + 1)) +import sys + +readline = sys.stdin.readline +A = readline().rstrip() +from collections import Counter + +counter = Counter(A) +ans = 1 + (len(A) * (len(A) - 1)) // 2 +for val in list(counter.values()): +    ans -= (val * (val - 1)) // 2 +print(ans)