Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Arrays;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String[] arrOne = scanner.nextLine().split(" ");
- String[] arrTwo = scanner.nextLine().split(" ");
- if (arrOne.length < arrTwo.length) {
- System.out.printf("%s\n%s\n", String.join("", arrOne), String.join("", arrTwo));
- } else if (arrTwo.length < arrOne.length) {
- System.out.printf("%s\n%s\n", String.join("", arrTwo), String.join("", arrOne));
- } else {
- int result = Arrays.toString(arrOne).compareTo(Arrays.toString(arrTwo));
- System.out.printf("%s\n%s\n",
- String.join("", result <= 0 ? arrOne : arrTwo),
- String.join("", result <= 0 ? arrTwo : arrOne)
- );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement