S = gets.to_s.chomp!

arr = S.split('')
uniq_arr = arr.uniq
first = uniq_arr[0]
second = uniq_arr[1]
if uniq_arr.size == 2 && arr.count(first) == 2 && arr.count(second) == 2
  puts 'Yes'
else
  puts 'No'
end
