output_description: If S consists of exactly two kinds of characters which both appear twice in S,
  print `Yes`; otherwise, print `No`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: # -*- coding: utf-8 -*-
  # abc132/abc132_a
  import sys
  import collections
  
  s2nn = lambda s: [int(c) for c in s.split(" ")]
  ss2nn = lambda ss: [int(s) for s in list(ss)]
  ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
  i2s = lambda: sys.stdin.readline().rstrip()
  i2n = lambda: int(i2s())
  i2nn = lambda: s2nn(i2s())
  ii2ss = lambda n: [i2s() for _ in range(n)]
  ii2nn = lambda n: ss2nn(ii2ss(n))
  ii2nnn = lambda n: ss2nnn(ii2ss(n))
  
  
  def main():
      S = i2s()
      c = collections.Counter(S)
      if tuple(c.values()) == (2, 2):
          print("Yes")
      else:
          print("No")
      return
  
  
  main()
  
problem_description: Statement
  
  You are given a 4-character string S consisting of uppercase English letters.
  Determine if S consists of exactly two kinds of characters which both appear
  twice in S.
samples: [{"input": "ASSA", "output": "Yes\n    \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n    \n\n* * *"}, {"input": "FFEE", "output": "Yes\n    \n\n* * *"}, {"input": "FREE", "output": "No"}]