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

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