func main() {
    guard let s = readLine() else {
        print("Error: input is empty")
        return
    }
    var m: [Character:Int] = [:]
    for c in s {
        if let v = m[c] {
            m[c] = v + 1
        } else {
            m[c] = 1
        }
    }
    for (_, v) in m {
        if v != 2 {
            print("No")
            return
        }
    }
    print("Yes")
}

main()
