Problem

9 /9


Additional ways to work with array elements

Theory Click to read/hide

Additional ways to work with array elements
Except for the for, you can also use foreach - it iterates over all elements of the array, without using indexes. Sometimes it can be convenient, for example, to display an array on the screen.   foreach(int i in A) { Console.Write(i + " "); }
And this is how you can read an array, the elements of which are written on one line and separated by a space, from the keyboard. using System.Linq; // you need to write this directive in order to use functions related to working with arrays ... string text = Console.ReadLine(); int[] array = text.Split(' ').Select(int.Parse).ToArray(); // Split() splits the string into separate objects (in this case, space division) // Select(int.Parse) converts each object (string) to an int // ToArray() writes all received objects to array

Problem

The input is the number N - the number of array elements. 
Then there are two arrays of N integers each: elements of the first array go one per line, elements of the second array are all written on one line separated by a space.
Fill in two arrays and output their elements separated by a space in one line: the first array in the first line, the second array in the second line.

 
Examples
# Input Output
1 3
1
2
3
4 5 6
1 2 3
4 5 6