403751: GYM101257 C Arcade
Description
Abdullah and Haritha were building a 3D printed arcade machine. Abdullah had worked on the hardware, while Haritha had been working on the game that will be running on the arcade machine.
The game is represented as a 2D grid of R rows and C columns. The goal of the game is to build the maximum possible number of Hackatari logos. Hackatari's logo consists of 5 symbols, they are: {x, o, > , - , | }. When the game starts, the player will have an infinite number of the first two symbols {x, and o}.
Each cell of the grid contains one of the three-to-last symbols of the logo, specifically, { > , - , or | }.
The player is placed at the top-left cell, and is only allowed to move to the cell below him, or to the one to his right. The player is not allowed to go outside the grid. To collect a symbol from a cell, the player needs to move to that cell. The goal of the game is to build the maximum number of Hackatari logos using the collected symbols.
Abdullah was testing Haritha’s game, recently, and he got a score of 103%, which means that the maximum score that Haritha expected, was less than the maximum score that the player can actually achieve.
Can you help Haritha fix his game by writing a program that finds the maximum number of logos that can actually be built??
InputThe first line of input contains two integers, R and C (1 ≤ R, C ≤ 100), the number of rows and the number of columns in the grid, respectively.
Each of the following R lines contains C characters, each character belongs to the set: { > , - , | }.
OutputOn a single line, print the maximum number of Hackatari logos.
ExamplesInput3 4Output
>|>-
-|->
->-|
2Input
4 2Output
>-
>-
>-
||
1