407043: GYM102697 014 Labyrinth

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

014. Labyrinthtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

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.

Input

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.

Output

Output a single integer t: the total number of traps in the labyrinth.

ExampleInput
4 5
x....
.x.x.
x..x.
x.xx.
Output
8
Note

Hint: use a 2D array!

加入题单

上一题 下一题 算法标签: