fun main(args: Array<String>) {
    val s = readLine()!!
    val n = s.length.toLong()
    val counts = ('a'..'z').map { c -> s.count { it ==c }.toLong() }
    val pairCounts = counts.map { it -> it * (it + 1) / 2 }
    val ans = 1 + n * (n + 1) / 2 - pairCounts.sum()
    println(ans)
}