str = $stdin.gets.chomp

abc = {}

for i in 0..str.size-1
  if abc[str[i]] == nil
     abc[str[i]] = 0
  end
  abc[str[i]] += 1
end
ans = "Yes"
abc.each do |k, v|
 if v != 2
   ans = "No"
   break
 end
end

puts ans