Zeshin

SPLITTASK

Mar 18th, 2021 (edited)
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. import java.lang.reflect.Array;
  2. import java.util.*;
  3. public class splittask {
  4.     public static void main(String[] args) {
  5.         String input = "3 2 4  5 | 3 45 5 | 3 8 7";
  6.         input = input.replaceAll("\\s+", "");
  7.         String[] splitinput = input.split("\\|");
  8.         for(int i = splitinput.length-1;i>-1;i--){
  9.             for(int j =0;j<splitinput[i].length();j++){
  10.                 System.out.print(splitinput[i].charAt(j)+" ");
  11.             }
  12.         }
  13.     }
  14. }
  15.  
Add Comment
Please, Sign In to add comment