


$hist = Hash.new

def add_to_hist(key)
    if $hist.has_key?(key)
        $hist[key] += 1
    else
        $hist[key] = 1
    end
end

def twotwo?
    return false unless $hist.length == 2
    $hist.each_pair {|*a| return false unless a[0][1] == 2}
    return true
end

def za
    a,b,c,d = gets.chomp.scan(/./)
#    puts a, b, c, d

    add_to_hist(a)
    add_to_hist(b)
    add_to_hist(c)
    add_to_hist(d)

#    p $hist
    puts twotwo? ? 'Yes' : 'No'
end

za
