fun main(args: Array<String>) {
    val A = readInputLine().toCharArray()

    val dp = LongArray(A.size)
    dp[0] = 1L

    val charCnt = LongArray('z' - 'a' + 1)
    charCnt[A[0] - 'a']++

    for (i in 1 until A.size) {
        dp[i] = dp[i - 1]
        for (j in 'a'..'z') {
            if (j == A[i]) {
                continue
            }
            dp[i] += charCnt[j - 'a']
        }
        charCnt[A[i] - 'a']++
    }

    println(dp[A.size - 1])
}

fun readInputLine(): String {
    return readLine()!!
}
