You are given 2 rectangular parallelepipeds (rectangular solids) in space, edges parallel to coordinate axes. Compute the volume of their union.
For example, consider the two following parallelepipeds (they are divided into unit cubes for clarity):
and
When combined in the following manner, their union is a figure of volume 12 (it consists of 12 unit blocks: ten on the bottom level, and two on the top level):
You are given a String[] parallelepipeds containing exactly two elements. Each element represents a single parallelepiped, and is formatted as "x1 y1 z1 x2 y2 z2" (quotes for clarity only), where (x1, y1, z1) and (x2, y2, z2) are the coordinates of opposing corners of the parallelepiped. |