Advertisement
kocev

TooLongSentence

Feb 24th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3.  
  4. public class TooLongSentence {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.         String[] sentence = scanner.nextLine().split("\\s+");
  8.         System.out.println(Arrays.asList(sentence));
  9.         if (sentence.length > 10){
  10.             System.out.println("Too long sentence");
  11.         }
  12.         else{
  13.             System.out.println(Arrays.asList(sentence));
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement