Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class HelloWorld {
  4.     public static void main(String[] args) {
  5.  
  6.       Scanner scan = new Scanner(System.in);
  7. String input = scan.nextLine();
  8. String [] arr = input.split(" ");
  9. int length = arr.length;
  10. switch (length){
  11.     case 1:
  12.         System.out.println("one"); break;
  13.     case 2:
  14.         System.out.println("two"); break;
  15.     case 3:
  16.         System.out.println("three"); break;
  17.     case 4:
  18.         System.out.println("four"); break;
  19.     case 5:
  20.         System.out.println("five"); break;
  21.     case 6:
  22.         System.out.println("six"); break;
  23.     case 7:
  24.         System.out.println("seven"); break;
  25.     case 8:
  26.         System.out.println("eight"); break;
  27.     case 9:
  28.         System.out.println("nine"); break;
  29.     case 10:
  30.         System.out.println("ten"); break;
  31.     default:
  32.         System.out.println("Too long sentence");
  33. }
  34.     }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement