Advertisement
vkarakolev

ListsEx7

Feb 25th, 2021
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class E07_AppendArrays {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         String[] arrays = scanner.nextLine().split("\\|");
  7.  
  8.         String result = "";
  9.         for (int i = arrays.length - 1; i >= 0; i--) {
  10.             String[] currentArr = arrays[i].split("\\s+");
  11.             for (int j = 0; j < currentArr.length; j++) {
  12.                 if(!currentArr[j].equals("")){
  13.                     result += currentArr[j] + " ";
  14.                 }
  15.             }
  16.         }
  17.         System.out.println(result);
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement