# First puzzle

This time, we need to calculate the wrapping paper to wrap a list gifts. The gifts are boxes, and the paper will wrap all the boxes entirely. In addition to the box area, an extra piece of paper the size of the smaller side is needed as well. The following are the examples given in the puzzle description:

- Length: 2, Width: 3 and Height: 4, the area is 52, and the smaller side is 6 leading to a total paper need of 58.
- Length: 1, Width:2, Height: 10, the area is 41, and the smaller side is 1 leading to a total paper need of 43.

Our input is a string with the gift’s length(l), width(w) and height(h) separated by “x”. For example, 10x20x30\n30x20x10 for two boxes.

First, we need to parse the input:

Based on that parsing, we can map the array of sides to the area of sides. Then sum all the sides area plus the smaller one:

# Second puzzle

For the second puzzle, the gifts ribbon and bow length needs to be calculated. The ribbon is the smaller perimeter on any surface and the bow is equaled to the value of the gift volume. For the examples above:

- 2x3x4 => ribbon 2 + 2 + 3 + 3 = 10 and bow 2 * 3 * 4 = 34 for total of 34.
- 1x1x10 => ribbon 1 + 1 + 1 + 1 = 4 and bow 1 * 1 * 10 = 10 for a total of 14.

Here is the code:

You can find this code along with my input and puzzle answers at here.