fun main(args: Array<String>) {
    val x = readLine()!!.split("").drop(1).dropLast(1)
    val (y,z) = x.partition { it ==x[0] }

    if (y.size ==2 && z.distinct().size ==1)
    {
        print("Yes")
    }
    else {
        print("No")
    }
}