Arcade

TimeLimit:3500MS  MemoryLimit:128MB
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description

Input/Output: standard input/output

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??



Input

The 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: { > ,  - , | }.

Output

On a single line, print the maximum number of Hackatari logos.

SampleInput
3 4
>|>-
-|->
->-|
SampleOutput
2
Submit
题目统计信息详细
总AC数4
通过人数4
尝试人数4
总提交量4
AC率100.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: