Introduction
In this challenge, you are given as input the ASCII representation of the net (unfolded surface) of a rectangular cuboid (3D box). The format is this:
....+--+.......
....|##|.......
....|##|.......
....|##|.......
+---+--+---+--+
|###|##|###|##|
+---+--+---+--+
....|##|.......
....|##|.......
....|##|.......
....+--+.......
Each face of the cuboid is a rectangle of #
s surrounded by +-|
-characters.
The outside of the net is filled with .
s.
The net will always have the same orientation: there's a middle face surrounded by its four neighboring faces, and the counterpart of the middle face is at the right border of the input.
The input is padded with .
s to a rectangular shape and will not contain extra rows or columns of .
s.
The task
Your task is to take as input a diagram as above, and compute the volume of the cuboid that it represents, which is just the product of its height, width and depth. You can take the input as a newline-delimited string or an array of strings.
The length of each edge is the distance between the +
-characters at its two ends.
For example, the horizontal edge +--+
has length 3, and the vertical edge
+
|
|
|
+
has length 4. The minimum length of an edge is 1. The example cuboid above has volume 2*3*4 = 24.
Rules and scoring
You can write a full program or a function, and the lowest byte count wins.
Test cases
.++..
+++++
+++++
.++..
1
...++....
...||....
...||....
+--++--++
+--++--++
...||....
...||....
...++....
3
..+-+....
..|#|....
+-+-+-+-+
|#|#|#|#|
|#|#|#|#|
+-+-+-+-+
..|#|....
..+-+....
12
.+---+.....
++---++---+
||###||###|
||###||###|
||###||###|
++---++---+
.+---+.....
16
....++.....
....||.....
....||.....
....||.....
+---++---++
|###||###||
|###||###||
|###||###||
+---++---++
....||.....
....||.....
....||.....
....++.....
16
...+--+......
...|##|......
...|##|......
+--+--+--+--+
|##|##|##|##|
+--+--+--+--+
...|##|......
...|##|......
...+--+......
18
....+--+.......
....|##|.......
....|##|.......
....|##|.......
+---+--+---+--+
|###|##|###|##|
+---+--+---+--+
....|##|.......
....|##|.......
....|##|.......
....+--+.......
24
....+-----+..........
....|#####|..........
....|#####|..........
....|#####|..........
+---+-----+---+-----+
|###|#####|###|#####|
|###|#####|###|#####|
|###|#####|###|#####|
|###|#####|###|#####|
+---+-----+---+-----+
....|#####|..........
....|#####|..........
....|#####|..........
....+-----+..........
120