{"raw_statement":[{"iden":"statement","content":"You find yourself stuck in a labyrinth and don't know your way out! There are several dangerous traps placed throughout the labyrinth. You need to find a way out, but first you need to know how many traps there are in the labyrinth.\n\nYou will be 2D grid with dimensions _n_ by _m_. _x_ denotes a trap, and _._ denotes no trap. The first line of input will contain two space-separated integers _n_ and _m_, representing the dimensions of the grid. The next _n_ lines will each contain _m_ characters representing a row of the labyrinth.\n\nOutput a single integer _t_: the total number of traps in the labyrinth.\n\nHint: use a 2D array!\n\n"},{"iden":"input","content":"You will be 2D grid with dimensions _n_ by _m_. _x_ denotes a trap, and _._ denotes no trap. The first line of input will contain two space-separated integers _n_ and _m_, representing the dimensions of the grid. The next _n_ lines will each contain _m_ characters representing a row of the labyrinth."},{"iden":"output","content":"Output a single integer _t_: the total number of traps in the labyrinth."},{"iden":"note","content":"Hint: use a 2D array!"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n, m \\in \\mathbb{Z}^+ $ denote the dimensions of a 2D grid.  \nLet $ G \\in \\{ \\text{`x'}, \\text{`.'} \\}^{n \\times m} $ be the grid representation, where `x` denotes a trap and `.` denotes no trap.\n\n**Constraints**  \n1. $ n \\geq 1 $, $ m \\geq 1 $  \n2. Each cell $ G[i][j] \\in \\{ \\text{`x'}, \\text{`.'} \\} $ for $ i \\in \\{1, \\dots, n\\} $, $ j \\in \\{1, \\dots, m\\} $\n\n**Objective**  \nCompute the total number of traps:  \n$$ t = \\sum_{i=1}^{n} \\sum_{j=1}^{m} \\mathbb{I}[G[i][j] = \\text{`x'}] $$  \nwhere $ \\mathbb{I}[\\cdot] $ is the indicator function.","simple_statement":"Count the number of 'x' in an n×m grid and output the total.","has_page_source":false}