Statement

## Goal

A building company needs to know how many 90 degree corners there are so that they can buy the right numbers of corner brackets. They don't need to worry about angled corners!

All background is space character.

The building's plan view is represented in ASCII art. There is one continuous wall. A wall always has a space between it and a boundary or another wall.
Input
Line 1 An integer W for the maximum width of the building
Line 2 An integer L for the maximum length of the building
Next L lines ASCII art representation of the building's plan
Output
Line 1 Total number of 90 degree corners
Constraints
4 ≤ W ≤ 42
4 ≤ L ≤ 42
Example
Input
```5
5

+-+
| |
+-+
```
Output
`4`

Game modes
FastestShortest

Test cases
Square box Test
Input
5 5 +-+ | | +-+
Output
4

Validator 1 Validator
Input
7 7 +---+ | | | | | | +---+
Output
4

Starry square Test
Input
6 6 **** * * * * ****
Output
4

Validator 2 Validator
Input
7 6 ***** * * * * *****
Output
4

Hashed map Test
Input
21 7 ##### ##### # # # # # ####### ##### # # ###################
Output
10

Validator 3 Validator
Input
19 6 #### #### #### # #### ##### # # # #################
Output
12

Dotty Test
Input
32 11 ...... ...... ...... . .... . ... .. . ... ..... . . . . ..... .. ..... . ....... ...... . . . . .. . . . . ....... .......
Output
32

Validator 4 Validator
Input
42 10 ............... ..... ..... . . . .. .. .. ... ...... ... .... . ... . . .. . ...... ....... . . .... ..... . . . . . ......................... .......
Output
36

Maximum footprint Test
Input
42 42 !!!!!!!!!! !!!!!!!!!! ! ! !!! ! ! !!!!!! !!!! !!! ! !!!!! !!! ! ! ! ! ! ! !!! !!! ! !!!!!!!! !!!!!! ! ! !!!! ! !!! !!! ! !!!!!! ! ! ! ! ! ! !!!!!!!! !!!!!! !!!!! !!!!! ! ! ! ! !!!!!! !!!!!! !!!!! !!! ! ! ! ! !!! !!!!!! !!!! ! !!!!!! !!!!!! ! ! ! ! ! ! !!! !!! ! !!!!!!!!!!!!!! ! ! ! ! ! !!!!!! ! ! ! ! ! ! ! !!!!!!! !!! !!!!!!! !!!!!! ! ! ! ! ! ! ! ! ! !!!!! ! ! ! ! ! !!!!!! !!!!! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !!!! !!!! ! ! ! ! ! ! ! ! ! ! ! !!!! !!!!! !!! ! ! ! ! ! ! ! ! ! ! ! ! !!!! ! ! ! ! ! ! ! !!!!!!!!!!!!!!!! ! ! !!!!!!!!!!!!
Output
96

Validator 5 Validator
Input
42 42 !!!!!!!!!! !!!!!!!!!! ! ! ! ! !!!!!! !!!! !!! !!!!!!! !!! ! ! ! ! ! ! !!! !!! ! !!!!!!!! !!!!!! ! ! !!!! ! !!! !!! ! !!!!!! ! ! ! ! ! ! !!!!!!!! !!!!!! !!!!! !!!!! ! ! ! ! !!!!!! !!!!!! !!!!! !!! ! ! ! ! !!! !!!!!! !!!! ! !!!!!! !!!!!! ! ! ! ! ! ! !!! !!! ! !!!!!!!!!!!!!! ! ! ! ! ! !!!!!! ! ! ! ! ! ! ! !!!!!!! !!! !!!!!!! !!!!!! ! ! ! ! ! ! ! ! ! !!!!! ! ! ! ! ! !!!!!! !!!!! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !!!! !!!! ! ! ! ! ! ! ! ! ! ! ! !!!! !!!!! !!! ! ! ! ! ! ! ! ! ! ! ! ! !!!! ! ! ! ! ! ! ! !!!!!!!!!!!!!!!! ! ! !!!!!!!!!!!!
Output
94

Angled walls don't count! Test
Input
20 10 %%%%%% %%%%%% % % % % % % % % % % % % % % % % % %%%% % % % %%%%%%%%%%%%%%%%%%
Output
6

Validator 6 Validator
Input
19 8 %%%% %% % % % % % %%%%% % % % % % %%%%%%%%%%%%%%%%%
Output
4

Solution language

Solution

Stub generator input
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
Online Participants