### Problem Statement

Battleship is a game in which two players try to sink each other's ships. Each player has a 10x10 square grid on which he must place 10 ships. Each ship consists of between 1 and 4 cells arranged in a straight line. Ships must be placed parallel to the sides of the board, and no two ships can share a cell or touch each other. Touching is defined as occupying cells that share a vertex. Each player must place the following ships on his board: 4 ships of length 1, 3 of length 2, 2 of length 3, and 1 of length 4.

The effectiveness of a player's board is defined as the number of rows that contain no ships plus the number of columns that contain no ships. You will be given a String[] board, where each element represents one row of a player's board. If the board does not follow the above rules, return "REJECTED". If it does, return "ACCEPTED, X POINTS", where X is the effectiveness of the board, with no extra leading zeros.

### Definition

 Class: BattleshipChecker Method: checkBoard Parameters: String[] Returns: String Method signature: String checkBoard(String[] board) (be sure your method is public)

### Notes

-The return value for an accepted board with a non-plural effectiveness must still end with "POINTS" (not "POINT").

### Constraints

-board will contain exactly 10 elements.
-Each element of board will contain exactly 10 characters.
-Each character of each element of board will be either '.' or 'X'.

### Examples

0)

 ```{"......X...", ".XXX..X...", "......X...", "X.X...X...", "X.........", "...XX.X...", "......X...", ".XX...X...", "..........", ".X.X..X..."}```
`Returns: "ACCEPTED, 5 POINTS"`
 This one is correct, and has 4 free columns and 1 free row, for a total of 5 points.
1)

 ```{"X.X.X.X...", "......X...", ".XX...X...", "......X...", "......X..X", "...X..X...", "...X..X...", "......X...", "..XX..X...", "......X..."}```
`Returns: "REJECTED"`
 It is unacceptable to have a ship of size 1x10.
2)

 ```{".....XX...", ".XX.......", "..........", ".X....XXX.", ".X........", ".....X....", "..X..X....", ".....X....", "...X......", "X.....XXXX"}```
`Returns: "REJECTED"`
 One 1x1 ship is missing.
3)

 ```{".....XX..X", ".XX......X", "..........", ".X....XXX.", ".X........", ".....X..X.", "..X..X....", ".....X....", "...X......", "X.....XXXX"}```
`Returns: "REJECTED"`
 There is one extra 1x2 ship.
4)

 ```{"X.......X.", "...XXXX...", ".X......X.", "....XX....", ".........X", ".........X", ".....XXX..", ".........X", "..X......X", "..X......X"}```
`Returns: "ACCEPTED, 0 POINTS"`
 This is a valid configuration even though it is not very effective.
5)

 ```{"X.......X.", "...XXXX...", ".X......X.", "....XX....", "...X.....X", "...X.....X", ".....XXX..", ".........X", ".........X", ".........X"}```
`Returns: "REJECTED"`
 Diagonal touching is not allowed.

#### Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=6800

#### Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=10002&pm=6800

soul-net

#### Testers:

PabloGilberto , brett1479 , Olexiy , Mike Mirzayanov

Search