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: n = int(input())
  p = [int(i) for i in input().split()]
  ctn = 0
  for j in range(1, n - 1):
      if p[j - 1] < p[j] < p[j + 1] or p[j + 1] < p[j] < p[j - 1]:
          ctn += 1
  print(ctn)
  
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"}]