Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import javafx.fxml.FXMLLoader;
- import org.w3c.dom.ls.LSOutput;
- import java.io.IOException;
- import java.util.Arrays;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) throws IOException {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- String [] firstArray = new String[n];
- String [] secondArray = new String[n];
- for (int i = 0; i <n ; i++)
- {
- String [] input =scanner.nextLine().split(" ");
- if (i % 2 ==0)
- {
- firstArray[i] = input[0];
- secondArray[i]= input[1];
- }
- else
- {
- firstArray[i] = input[1];
- secondArray[i]= input[0];
- }
- }
- System.out.println(String.join(" ",firstArray));
- System.out.println(String.join(" ",secondArray));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement