A = eval(input())

l = len(A)

from collections import Counter

from string import ascii_lowercase

c = Counter(A)

a = (l * (l - 1)) // 2

s = sum([c[j] * (c[j] - 1) // 2 for j in ascii_lowercase])

print((a - s + 1))

A = eval(input())

l = len(A)

from collections import Counter

from string import ascii_lowercase

c = Counter(A)

a = ((l * (l - 1)) // 2) + 1

for j in ascii_lowercase:

    a -= (c[j] * (c[j] - 1) // 2)

print(a)
A = eval(input())
l = len(A)
from collections import Counter
from string import ascii_lowercase

c = Counter(A)
a = (l * (l - 1)) // 2
s = sum([c[j] * (c[j] - 1) // 2 for j in ascii_lowercase])
print((a - s + 1))

A = eval(input())
l = len(A)
from collections import Counter
from string import ascii_lowercase

c = Counter(A)
a = ((l * (l - 1)) // 2) + 1
for j in ascii_lowercase:
    a -= c[j] * (c[j] - 1) // 2
print(a)

-a = (l * (l - 1)) // 2 -s = sum([c[j] * (c[j] - 1) // 2 for j in ascii_lowercase]) -print((a - s + 1)) +a = ((l * (l - 1)) // 2) + 1 +for j in ascii_lowercase: +    a -= c[j] * (c[j] - 1) // 2 +print(a)