Back
Close

Will my boat sink?

Statement

 Goal

You are looking for holes in the hull of my boat. If there are at least one hole below sea level, then the boat will sink.

With your super-vision, you can see all the boat at once... but only in ASCII art. The water is always represented by ~ and the boat is outlined by \ and /. Holes are O, o or 0. But these icons can also represent non-hole objects when not inside a boat (like a fish for example), and a hole between brackets "{}" is a window!

Print the number of holes.
Input
Line 1 : Number N of line composing my boat.
N next lines : My boat
Output
X holes
Constraints
0 < N <= 30
Length of line <= 50
Example
Input
4
    |\  o
    | \-|______
~~~~~~~~\__o__/~~~~
~~~~~~~~~~~~~~~~~~~
Output
1

Game modes
Fastest

Test cases
Fisherman's boat Test
Input
4 |\ o | \-|______ ~~~~~~~~\__o__/~~~~ ~~~~~~~~~~~~~~~~~~~
Output
1

Fisherman's boat Validator
Input
4 |\ o | \-|______ ~~~(O)~~\_____/~~~~~ ~~~^^^~~~~~~~~~~~~~~
Output
0

Fishermen's boat Test
Input
4 |\ o o /| | \-|_____|-/ | ~(O)~~\_____/~~(O)~ ~^^^~~~~~~~~~~~^^^~
Output
0

Fishermen's boat Validator
Input
4 |\ o o /| | \-|_____|-/ | ~~~~~~\o____/~~~~~~ ~~~~~~~~~~~~~~~~~~~
Output
1

Motorboat Test
Input
5 __ _____/_ | o \ |*|____-- ~~~\__0_________o_/~~~ ~~~~~~~~~~~~~~~~~~@@~~
Output
2

Motorboat Validator
Input
5 __ _____/_ | O \ |o|____-- ~~~\oooo__________/~~~ ~~~~~~~~~~~~~~~~~~@@~~
Output
4

People swimming Test
Input
10 __ /||\ / || \ / || \ ----||---- <| || ____|___||________ ~~~~~~~~~|\ /~~~~~~~ ~~>--o~~~|~\ O{o} {o} /~~~~~~~~ ~~~~~~~~~|~~\o_____0___OO/~~~o--<~~
Output
5

People swimming Validator
Input
10 __ /||\ / || \ / || \ ----||---- <| || ____|___||________ ~~~~~~~~~|\ ooo /~~>--o~ ~~>--o~~~|~\ {o}0o0 {0} /~~~~~~~~ ~~~~o--<~|~~\_____O______/~~~o--<~~
Output
7

Very little boat Test
Input
1 ~\_/~
Output
0

Very little boat Validator
Input
1 ~\_/~
Output
0

Complex boat with everything Test
Input
30 __ ____ || _______/ ||| <____________\|| || /||--|\ / || (_^\ /v || ) .^ /^| || | _\ /^.^| || (_ ^ /^- ( || | ^\ /^ | || | _\ /_ _) || | ^ /_ | || | ^\ /_ | || | _\ /_ (_ || | ^ /_ | || _) ^ /. | || | ^\ /_ | || | ^\ /_ (_ || _) _\ /_ | || | _\ /^ _________|-|| _) \ ^_____/ ||-|______________________^ ______ || \__ |_______________||_________________________ ~~~\_ Oo0 ^^ __/~ ~~~~~\ {O} {O} _/~~~~ ~~(O)~\_________________________________0___/~~~~~ ~~^^^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Output
4

Complex boat with everything Validator
Input
30 __ ____ || _______/ ||| <____________\|| || /||--|\ / || (_^\ /v || ) .^ /^| || | _\ /^.^| || (_ ^ /^- ( || | ^\ /^ | || | _\ /_ _) || | ^ /_ | || | ^\ /_ | || | _\ /_ (_ || | ^ /_ | || _) ^ /. | || | ^\ /_ | || | ^\ /_ (_ || _) _\ /_ | || | _\ /^ _________|-|| _) \ ^_____/ ||-|______________________^ ______ || \__ |_______________||_________________________ ~~~\_ ^^ __/~ ~~~~~\ {O} 0 {O} _/~~~~ ~~(O)~\_____________________________________/~~(O) ~~^^^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^ ~~~~~~~~~~~~o--<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Output
1

Solution language

Solution

Stub generator input