s = gets.split(//).map(&:to_s)

count = Hash.new(0)
s.each do |str|
    count[str] += 1
end

d = count.values
flg = 0
d.each do |d|
    if d == 2
        flg += 1
    end
end

if flg == 2
    puts "Yes"
else
    puts "No"
end