Rating: 4.0

# Batlle boats in space

The challenge asks us to find a `m x n` matrix consisting of only `B` and `~` characters

Checking 'battleship.c', we can see more than 1000 lines of code

We easily notice the map check code snippet but how to print the map with around 1000 lines of `if`

However, every `if` have the same format that compare `a[i][j] != c` so we can change `!=` to `=` and run the code again

Then we get a map:
```
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~BBBBB~~B~~~~~~B~~BBBBB~~BBBBBBB~BBBBBBB~~~~B~~BBBBB~~BBBBBBB~B~~~~~B~B~~~~B~~~~~~~~~BBBBBBB~B~~~~~~B~~~~B~~~BBBBBBB~~~~~~~~~~BBBBB~~B~~~~~~B~BBBBBBB~BBBBBB~~B
~B~~~~~B~B~~~~~~B~B~~~~~B~~~~B~~~~B~~~~~~~~~B~~B~~~~~B~~~~B~~~~BB~~~~B~B~~~B~~~~~~~~~~~~~B~~~~B~~~~~~B~~~B~B~~~~~B~~~~~~~~~~~~B~~~~~B~B~~~~~~B~~~~B~~~~B~~~~~B~~
~B~~~~~~~B~~~~~~B~B~~~~~~~~~~B~~~~BBBBB~~~~B~~~B~~~~~~~~~~B~~~~B~B~~~B~B~~B~~~~~~~~~~~~~~B~~~~B~~~~~~B~~~B~B~~~~~B~~~~~~~~~~~~B~~~~~~~B~~~~~~B~~~~B~~~~B~~~~~B~~
~~BBBBB~~BBBBBBBB~B~~~~~~~~~~B~~~~B~~~~~~~B~~~~~BBBBB~~~~~B~~~~B~~B~~B~BB~~~~~~~~~~~~~~~~B~~~~BBBBBBBB~~BBBBB~~~~B~~~~~~~~~~~~~BBBBB~~BBBBBBBB~~~~B~~~~BBBBBB~~~
~~~~~~~B~B~~~~~~B~B~~~~~~~~~~B~~~~B~~~~~~~~B~~~~~~~~~B~~~~B~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