def solve(s)
  m = {}
  s.split('').each do |i|
    v = m.key?(i) ? m[i] : 0
    m.merge!({i => v + 1})
  end

  m.each do |_, v|
    return 'No' if v != 2
  end

  'Yes'
end

def main
  stdin = STDIN.gets
  s = stdin.strip!
  puts solve(s)
end

main