output_description: If Snuke can create a matrix satisfying the condition, print `Yes`; otherwise,
  print `No`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      H W
      a_{11}a_{12}...a_{1W}
      :
      a_{H1}a_{H2}...a_{HW}
attempt: import sys
  import collections
  
  sys.setrecursionlimit(10**8)
  
  input = sys.stdin.readline
  
  
  def main():
      H, W = [int(x) for x in input().split()]
      A = [input().strip() for _ in range(H)]
  
      c = collections.Counter()
      for a in A:
          for aa in a:
              c[aa] += 1
  
      four_cnt = (H // 2) * (W // 2)
      two_cnt = (H % 2) * (W // 2) + (W % 2) * (H // 2)
      one_cnt = (H % 2) * (W % 2)
  
      for k in c.keys():
          if c[k] >= 4:
              q, r = divmod(c[k], 4)
              mi = min(four_cnt, q)
              c[k] -= mi * 4
              four_cnt -= mi
  
      for k in c.keys():
          if c[k] >= 2:
              q, r = divmod(c[k], 2)
              mi = min(two_cnt, q)
              c[k] -= mi * 2
              two_cnt -= mi
  
      for k in c.keys():
          if c[k] >= 1:
              q, r = divmod(c[k], 1)
              mi = min(one_cnt, q)
              c[k] -= mi * 1
              one_cnt -= mi
  
      if sum([four_cnt, two_cnt, one_cnt]) == 0:
          print("Yes")
      else:
          print("No")
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  We have an H-by-W matrix. Let a_{ij} be the element at the i-th row from the
  top and j-th column from the left. In this matrix, each a_{ij} is a lowercase
  English letter.
  
  Snuke is creating another H-by-W matrix, A', by freely rearranging the
  elements in A. Here, he wants to satisfy the following condition:
  
    * Every row and column in A' can be read as a palindrome.
  
  Determine whether he can create a matrix satisfying the condition.
samples: [{"input": "3 4\n    aabb\n    aabb\n    aacc", "output": "Yes\n    \n\nFor example, the following matrix satisfies the condition.\n\n    \n    \n    abba\n    acca\n    abba\n    \n\n* * *"}, {"input": "2 2\n    aa\n    bb", "output": "No\n    \n\nIt is not possible to create a matrix satisfying the condition, no matter how\nwe rearrange the elements in A.\n\n* * *"}, {"input": "5 1\n    t\n    w\n    e\n    e\n    t", "output": "Yes\n    \n\nFor example, the following matrix satisfies the condition.\n\n    \n    \n    t\n    e\n    w\n    e\n    t\n    \n\n* * *"}, {"input": "2 5\n    abxba\n    abyba", "output": "No\n    \n\n* * *"}, {"input": "1 1\n    z", "output": "Yes"}]