input = gets.chomp.split("")
if input[0] == input[1] then
    if input[2] == input[3] then
        print "Yes"
    else
        print "No"
    end
elsif input[0] == input[2] then
    if input[1] == input[3] then
        print "Yes"
    else
        print "No"
    end
elsif input[0] == input[3] then
    if input[1] == input[2] then
        print "Yes"
    else
        print "No"
    end
else
print "No"
end