# AGC019B - Reverse and Compare

from collections import Counter





def main():

    S = input().rstrip()

    C, N = list(Counter(S).values()), len(S)

    ans = N * (N - 1) // 2 + 1  # all possible patterns

    ans -= sum(i * (i - 1) // 2 for i in C)  # duplicates

    print(ans)





if __name__ == "__main__":

    main()
# AGC019B - Reverse and Compare

def main():

    S = input().rstrip()

    N = len(S)

    ans = N * (N - 1) // 2 + 1  # all possible patterns

    abc = "abcdefghijklmnopqrstuvwxyz"

    for a in abc:

        x = S.count(a)

        ans -= x * (x - 1) // 2  # exclude duplicates

    print(ans)





if __name__ == "__main__":

    main()
# AGC019B - Reverse and Compare
from collections import Counter


def main():
    S = input().rstrip()
    C, N = list(Counter(S).values()), len(S)
    ans = N * (N - 1) // 2 + 1  # all possible patterns
    ans -= sum(i * (i - 1) // 2 for i in C)  # duplicates
    print(ans)


if __name__ == "__main__":
    main()

# AGC019B - Reverse and Compare
def main():
    S = input().rstrip()
    N = len(S)
    ans = N * (N - 1) // 2 + 1  # all possible patterns
    abc = "abcdefghijklmnopqrstuvwxyz"
    for a in abc:
        x = S.count(a)
        ans -= x * (x - 1) // 2  # exclude duplicates
    print(ans)


if __name__ == "__main__":
    main()

-from collections import Counter - - -    C, N = list(Counter(S).values()), len(S) +    N = len(S) -    ans -= sum(i * (i - 1) // 2 for i in C)  # duplicates +    abc = "abcdefghijklmnopqrstuvwxyz" +    for a in abc: +        x = S.count(a) +        ans -= x * (x - 1) // 2  # exclude duplicates