import Foundation
 
let input = readLine()!
 
let S = Array(input.characters)

if S[0] == S[1] && S[1] == S[2] && S[2] == S[3] {
	print("No")
}else if S[0] == S[2] && S[1] == S[3] {
    print("Yes")
} else if S[1] == S[2] && S[0] == S[3] {
    print("Yes")
} else if S[0] == S[1] && S[2] == S[3] {
    print("Yes")
} else {
    print("No")
}
