title: I have an N*M matrix of characters and I'm trying to find the most common character in the whole matrix but instead it's only counting the last row
body: <p>I'm trying to get the most common character from a matrix but instead I'm only getting the most common from the last entered row</p>
  <pre><code>R = int(input(&quot;Enter the number of rows:&quot;))
  C = int(input(&quot;Enter the number of columns:&quot;))
  matrix = []
  print(&quot;Enter the elements rowwise:&quot;)
  for i in range(R):
      a=[]
      for j in range(C):
          a.append((input()))
      matrix.append(a)
  for i in range(R):
      for j in range(C):
          print(matrix[i][j], end = &quot; &quot;)
      print()
  from collections import Counter
  count = Counter(a)
  print(count.most_common())
  </code></pre>
  <p>output:</p>
  <pre><code>Enter the number of rows:3
  Enter the number of columns:3
  Enter the elements rowwise:
  a
  a
  a
  e
  e
  d
  c
  c
  a
  a a a 
  e e d 
  c c a 
  [('c', 2), ('a', 1)]
  </code></pre>