Guest User

Untitled

a guest
Sep 12th, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. package ex_27May_2014;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class p3_Longest_Odd_Even_Sequence {
  6.  
  7.     public static void main(String[] args) {
  8.         /*
  9.          *  input = (3) (22) (-18) (55) (44) (3) (21)
  10.          */
  11.        
  12.         Scanner scan = new Scanner(System.in);
  13.        
  14.         String[] number = scan.nextLine().split("[\\D ]+");
  15.        
  16.         for (int i = 0; i < number.length; i++) {
  17.             System.out.println(number[i]);
  18.         }
  19.        
  20.         /*
  21.          * output =  
  22.          * (empty entry)
  23.          * 3
  24.          * 22
  25.          * 18
  26.          * 55
  27.          * 44
  28.          * 3
  29.          * 21
  30.          */
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment