fun main(args: Array<String>) {
    val a = readLine()!!.groupBy { it }.values.map { it.size.toLong() }.toLongArray()
    var ans = 1L
    for (i in a.indices) {
        for (j in 0 until i) {
            ans += a[i] * a[j]
        }
    }
    println(ans)
}
