#K38202. Concatenating 2x2 Arrays
Concatenating 2x2 Arrays
Concatenating 2x2 Arrays
You are given two lists of 4 integers each. Each list represents a 2x2 matrix in row‐major order. Your task is to concatenate these two matrices along the horizontal axis (i.e. axis 1) so that the output is a 2x4 matrix.
The first two numbers in a list form the first row and the last two numbers form the second row. Then, the two matrices are joined side by side.
For example, if the input arrays are [1, 2, 3, 4] and [5, 6, 7, 8], then the resulting matrix is:
$$ \begin{bmatrix} 1 & 2 & 5 & 6 \\ 3 & 4 & 7 & 8 \end{bmatrix} $$Solve this problem by reading from standard input and writing the concatenated matrix to standard output.
inputFormat
The input consists of two lines.
The first line contains 4 space-separated integers representing the first 2x2 matrix in row-major order.
The second line contains 4 space-separated integers representing the second 2x2 matrix in row-major order.
outputFormat
Output the resulting 2x4 matrix as two lines. Each line should contain 4 space-separated integers corresponding to the concatenated rows of the matrices.
## sample1 2 3 4
5 6 7 8
1 2 5 6
3 4 7 8
</p>