program main
    use,intrinsic :: iso_fortran_env
    implicit none
    character(200000):: a
    integer(int64):: i,l,ia,ans
    integer(int64):: cnt(ichar("a"):ichar("z"))
    
    read*, a
    cnt(:) = 0
    l = len_trim(a)
    do i=1,l
        ia = ichar(a(i:i))
        cnt(ia) = cnt(ia) + 1
    end do

    ans = (l*(l-1))/2
    do i=ichar("a"),ichar("z")
        ans=ans-(cnt(i)*(cnt(i)-1))/2
    end do
    print'(i0)', ans+1
end program main