Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ex_27May_2014;
- import java.util.Scanner;
- public class p3_Longest_Odd_Even_Sequence {
- public static void main(String[] args) {
- /*
- * input = (3) (22) (-18) (55) (44) (3) (21)
- */
- Scanner scan = new Scanner(System.in);
- String[] number = scan.nextLine().split("[\\D ]+");
- for (int i = 0; i < number.length; i++) {
- System.out.println(number[i]);
- }
- /*
- * output =
- * (empty entry)
- * 3
- * 22
- * 18
- * 55
- * 44
- * 3
- * 21
- */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment