s = gets.chomp.split('')
a = s.slice!(0)

if s.uniq.length == 1
    puts("No")
else
    if s.include?(a)
        s.slice!(s.index(a))
       
        if s.uniq.length == 1
            puts("Yes")
        end
    else
        puts("No")
    end
end