SHARE
TWEET

Untitled

a guest Apr 14th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package AdvertisementMessage;
  2. import java.io.IOException;
  3. import java.lang.reflect.Array;
  4. import java.text.DecimalFormat;
  5. import java.util.*;
  6. import java.util.concurrent.CopyOnWriteArrayList;
  7. import java.util.stream.Collectors;
  8.  
  9. public class Main {
  10.  
  11.     public static void main(String[] args) throws IOException {
  12.  
  13.         Scanner scanner = new Scanner(System.in);
  14.  
  15.         List<String> data = Arrays.stream(scanner.nextLine().split("\\|+"))
  16.                 .collect(Collectors.toList());
  17.  
  18.         int n = data.size();
  19.  
  20.         while (n-- > 0) {
  21.             ArrayList<String> writer = new ArrayList<>();
  22.             writer.add(data.get(n));
  23.             String toPrint = writer.toString().replaceAll("[\\]\\[,]", "").trim();
  24.             toPrint = toPrint.replaceAll("\\s+", " ");
  25.             System.out.print(toPrint + " ");
  26.         }
  27.  
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top