a = eval(input())

total = 1 + (len(a) * (len(a) - 1) // 2)



for i in range(97, 97 + 26):

    atoz = (a.count(chr(i)) * (a.count(chr(i)) - 1)) // 2

    total -= atoz



print(total)

a=eval(input())

b=1+(len(a)*(len(a)-1)//2)

for i in range(97,123):

    c=a.count(chr(i))

    d=(c*(c-1))//2

    b-=d

print(b)
a = eval(input())
total = 1 + (len(a) * (len(a) - 1) // 2)
for i in range(97, 97 + 26):
    atoz = (a.count(chr(i)) * (a.count(chr(i)) - 1)) // 2
    total -= atoz
print(total)

a = eval(input())
b = 1 + (len(a) * (len(a) - 1) // 2)
for i in range(97, 123):
    c = a.count(chr(i))
    d = (c * (c - 1)) // 2
    b -= d
print(b)

-total = 1 + (len(a) * (len(a) - 1) // 2) -for i in range(97, 97 + 26): -    atoz = (a.count(chr(i)) * (a.count(chr(i)) - 1)) // 2 -    total -= atoz -print(total) +b = 1 + (len(a) * (len(a) - 1) // 2) +for i in range(97, 123): +    c = a.count(chr(i)) +    d = (c * (c - 1)) // 2 +    b -= d +print(b)