Advertisement
vov44k

Untitled

Apr 25th, 2022
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner in = new Scanner(System.in);
  8.         String a = in.nextLine();
  9.         String[] b = a.split(" ");
  10.         for (int i = 0; i < b.length - 1; i ++)
  11.             if (b[i].length() > 0 || i ==0)
  12.                 System.out.print(b[i] + " ");
  13.         System.out.print(b[b.length - 1]);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement