s = gets.chomp
#puts "#{s}"
moji = s.chars
#puts "#{moji}"
moji.sort!
#puts "#{moji}"

if (moji[0] == moji[1] || moji[2] == moji[3])
    if moji[0] == moji[2]
        puts "No"
    else 
        puts "Yes"
    end
else
    puts "No"
end
