import collections
a = input()
n = len(a)
A = collections.Counter(a)
v, c = zip(*A.most_common())
ans = n * (n - 1) // 2
for i in range(len(c)):
    ans -= c[i] * (c[i] - 1) // 2
print(ans + 1)

e5f74f5db2b0b554b268784b774296c04fce9100
<mask token>

<mask token>
for i in range(len(c)):
    ans -= c[i] * (c[i] - 1) // 2
print(ans + 1)

<mask token>
a = input()
n = len(a)
A = collections.Counter(a)
v, c = zip(*A.most_common())
ans = n * (n - 1) // 2
for i in range(len(c)):
    ans -= c[i] * (c[i] - 1) // 2
print(ans + 1)

import collections
a = input()
n = len(a)
A = collections.Counter(a)
v, c = zip(*A.most_common())
ans = n * (n - 1) // 2
for i in range(len(c)):
    ans -= c[i] * (c[i] - 1) // 2
print(ans + 1)
