<commit_before># Title

[2015-10-21] Challenge #237 [Intermediate] Heighmap of Boxes

# Difficulty

Intermediate

#Description

Have a look at this ascii art diagram of various boxes:

    +--------------------------------------------------------------+
    |                                                              |
    |   +-------------------------------+          +-------+       |
    |   |                               |          |       |       |
    |   |                               |          |       |       |
    |   |     +----------------+        |          |       |       |
    |   |     |                |        |          +-------+       |
    |   |     |                |        |                          |
    |   |     |                |        |          +-------+       |
    |   |     +----------------+        |          |       |       |
    |   |                               |          |       |       |
    |   |                               |          |       |       |
    |   +-------------------------------+          +-------+       |
    |                                                              |
    +--------------------------------------------------------------+

Each box is formed with pipe characters for the vertical parts (`|`), dashes for the horizontal parts (`-`), and pluses for the corners (`+`).

The diagram also shows boxes inside other boxes. We'll call the number of boxes that a box is contained within that box's _layer_. Here's the diagram again with the layer of each box annotated:

    +--------------------------------------------------------------+
    |                                                              |
    |   +-------------------------------+          +-------+       |
    |   |                               |          |       |       |
    |   |                               |          |   1   |       |
    |   |     +----------------+        |          |       |       |
    |   |     |                |        |    0     +-------+       |
    |   |     |        2       |   1    |                          |
    |   |     |                |        |          +-------+       |
    |   |     +----------------+        |          |       |       |
    |   |                               |          |   1   |       |
    |   |                               |          |       |       |
    |   +-------------------------------+          +-------+       |
    |                                                              |
    +--------------------------------------------------------------+

Your program will take in a box diagram similiar to the one at the top as input. As output, your program should output the box diagram with:

 * Boxes on layer 0 should be filled with the character `#`;
 * Boxes on layer 1 should be filled with the character `=`;
 * Boxes on layer 2 should be filled with the character `-`;
 * Boxes on layer 3 should be filled with the character `.`;
 * Boxes on layer 4 and above should not be filled.

Here is what the output of the above input should look like:

    +--------------------------------------------------------------+
    |##############################################################|
    |###+-------------------------------+##########+-------+#######|
    |###|===============================|##########|=======|#######|
    |###|===============================|##########|=======|#######|
    |###|=====+----------------+========|##########|=======|#######|
    |###|=====|----------------|========|##########+-------+#######|
    |###|=====|----------------|========|##########################|
    |###|=====|----------------|========|##########+-------+#######|
    |###|=====+----------------+========|##########|=======|#######|
    |###|===============================|##########|=======|#######|
    |###|===============================|##########|=======|#######|
    |###+-------------------------------+##########+-------+#######|
    |##############################################################|
    +--------------------------------------------------------------+

#Formal Inputs and Outputs

##Input

Input shall begin with two space separated integers `N` and `M` on the first line. Following that will be `N` lines with `M` characters each which represent the ascii art diagram.

##Output

Output the map with the boxes of different layers filled in with their appropriate characters.

#Sample Inputs and Outputs

##Sample Input

    +-----------------------------------------------------------------------+
    |     +--------------------------------------------------------------+  |
    |     |      +-----------------------------------------------------+ |  |
    |     |      |         +-----------------------------------------+ | |  |
    |     |      |         |           +---------------------------+ | | |  |
    |     |      |         |           |                           | | | |  |
    |     |      |         |           |                           | | | |  |
    |     |      |         |           |                           | | | |  |
    |     |      |         |           +---------------------------+ | | |  |
    |     |      |         |                                         | | |  |
    |     |      |         +-----------------------------------------+ | |  |<commit_msg>Update ZZ_heightmap_of_boxes.md<commit_after># Title

[2015-10-21] Challenge #237 [Intermediate] Heighmap of Boxes

# Difficulty

Intermediate

#Description

Have a look at this ASCII art diagram of various boxes:

    +--------------------------------------------------------------+
    |                                                              |
    |   +-------------------------------+          +-------+       |
    |   |                               |          |       |       |
    |   |                               |          |       |       |
    |   |     +----------------+        |          |       |       |
    |   |     |                |        |          +-------+       |
    |   |     |                |        |                          |
    |   |     |                |        |          +-------+       |
    |   |     +----------------+        |          |       |       |
    |   |                               |          |       |       |
    |   |                               |          |       |       |
    |   +-------------------------------+          +-------+       |
    |                                                              |
    +--------------------------------------------------------------+

Each box is formed with pipe characters for the vertical parts (`|`), dashes for the horizontal parts (`-`), and pluses for the corners (`+`).

The diagram also shows boxes inside other boxes. We'll call the number of boxes that a box is contained within that box's _layer_. Here's the diagram again with the layer of each box annotated:

    +--------------------------------------------------------------+
    |                                                              |
    |   +-------------------------------+          +-------+       |
    |   |                               |          |       |       |
    |   |                               |          |   1   |       |
    |   |     +----------------+        |          |       |       |
    |   |     |                |        |    0     +-------+       |
    |   |     |        2       |   1    |                          |
    |   |     |                |        |          +-------+       |
    |   |     +----------------+        |          |       |       |
    |   |                               |          |   1   |       |
    |   |                               |          |       |       |
    |   +-------------------------------+          +-------+       |
    |                                                              |
    +--------------------------------------------------------------+

Your program will take in a box diagram similiar to the one at the top as input. As output, your program should output the box diagram with:

 * Boxes on layer 0 should be filled with the character `#`;
 * Boxes on layer 1 should be filled with the character `=`;
 * Boxes on layer 2 should be filled with the character `-`;
 * Boxes on layer 3 should be filled with the character `.`;
 * Boxes on layer 4 and above should not be filled.

Here is what the output of the above input should look like:

    +--------------------------------------------------------------+
    |##############################################################|
    |###+-------------------------------+##########+-------+#######|
    |###|===============================|##########|=======|#######|
    |###|===============================|##########|=======|#######|
    |###|=====+----------------+========|##########|=======|#######|
    |###|=====|----------------|========|##########+-------+#######|
    |###|=====|----------------|========|##########################|
    |###|=====|----------------|========|##########+-------+#######|
    |###|=====+----------------+========|##########|=======|#######|
    |###|===============================|##########|=======|#######|
    |###|===============================|##########|=======|#######|
    |###+-------------------------------+##########+-------+#######|
    |##############################################################|
    +--------------------------------------------------------------+

#Formal Inputs and Outputs

##Input

Input shall begin with two space separated integers `N` and `M` on the first line. Following that will be `N` lines with `M` characters each which represent the ASCII art diagram.

##Output

Output the map with the boxes of different layers filled in with their appropriate characters.

#Sample Inputs and Outputs

##Sample Input

    20 73
    +-----------------------------------------------------------------------+
    |     +--------------------------------------------------------------+  |
    |     |      +-----------------------------------------------------+ |  |
    |     |      |         +-----------------------------------------+ | |  |
    |     |      |         |           +---------------------------+ | | |  |
    |     |      |         |           |                           | | | |  |
    |     |      |         |           |                           | | | |  |
    |     |      |         |           |                           | | | |  |
    |     |      |         |           +---------------------------+ | | |  |
    |     |      |         |                                         | | |  |
    |     |      |         +-----------------------------------------+ | |  |
{'fraction_non_alphanumeric': 0.3914375928677563, 'fraction_numerical': 0.004271916790490341, 'mean_word_length': 0.6206170052671182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 89, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7042712', 'n_tokens_mistral': 2341, 'n_tokens_neox': 2180, 'n_words': 463}