Hills and Valleys
Statement
Goal
Given the outline of a landscape of width w and height h, determine how many hills and valleys there are.The outline will consists of /, \, _, and spaces. An outline will always have exactly one character per column. An outline looks like this:
__
/ \
_/ \ __/\__
\_/
A hill has a '/' at the beginning and a '\' at the end
A valley has a '\' at the beginning and a '/' at the end
Input
Line 1: Two space-separated integers w and h
Next h lines: A String of length w that represents a single row of the outline
Next h lines: A String of length w that represents a single row of the outline
Output
One line with two space-separated integers for the number of hills and valleys
Constraints
There is exactly 1 non-space character per column
Example
Input
16 4 __ / \ _/ \ __/\__ \_/
Output
2 1
Game modes
Fastest, Shortest
Test cases
Simple Terrain Test
Input
16 4
__
/ \
_/ \ __/\__
\_/
Output
2 1
Validator 1 Validator
Input
18 4
__
/ \
_/ \ __/\__/\
\_/
Output
3 2
Spikey! Test
Input
16 1
/\/\/\/\/\/\/\/\
Output
8 7
Validator 2 Validator
Input
17 1
/\/\/\/\/\/\/\/\/
Output
8 8
Moon Crater Test
Input
16 4
__ __
\ /
\ /
\______/
Output
0 1
Validator 3 Validator
Input
16 4
__ _
\ _/
\ /
\______/
Output
0 1
Bumpy Moon Crater Test
Input
20 4
__ __
\ /
\ ____ /
\__/ \__/
Output
1 2
Validator 4 Validator
Input
20 4
__ __
\ /
\ _/\_ /
\__/ \__/
Output
1 2
Crazy Terrain! Test
Input
39 7
_
/ \/\
__/ \_
\_/\ _/\_
\ __ _/ \
\ / \/ \
\___/ \__/\
Output
6 5
Validator 5 Validator
Input
39 7
_
/ \/\
/\/ \_
\_/\ _/\_
\ __ _/ \
\ / \/ \
\___/ \__/\
Output
7 6
Going Up! Test
Input
8 4
_/
_/
_/
_/
Output
0 0
Validator 6 Validator
Input
8 4
\_
\_
\_
\_
Output
0 0
Solution language
Solution
Stub generator input