The School Corridor
UptoSkills Arena has a new building, and the students are exploring it. The main corridor is a rectangular grid of classrooms. Some classrooms are occupied, and some are empty. A student wants to know how many classrooms on the main corridor are occupied. Can you help them count?
The corridor is represented as a 2D grid where 'O' denotes an occupied classroom and 'E' denotes an empty classroom.
Input
The first line contains two integers N and M, representing the number of rows and columns in the grid, respectively. The next N lines each contain M characters, representing the grid.
Output
Print a single integer, the total number of occupied classrooms ('O').
Constraints
1 <= N, M <= 1000. The grid contains only 'O' and 'E' characters.
Example 1
3 4 EOEE OEOE EEEO
4
There are 4 occupied classrooms ('O').
Example 2
2 2 OO OO
4
All 4 classrooms are occupied.
Hints
# Read the input from stdin and print the answer.
import sys
def main():
data = sys.stdin.read().split()
# your code here
main()
3 4 EOEE OEOE EEEO
2 2 OO OO