package com.javarush.task.task07.task0713;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Играем в Jолушку
*/
public class Solution {
public static void main(String[] args) throws Exception {
ArrayList<Integer> list = new ArrayList<>();
BufferedReader reader = new BufferedReader( new InputStreamReader (System.in));//напишите тут ваш кодBufferedReader reader = new BufferedReader( new InputStreamReader (System.in));
ArrayList<Integer> list3 = new ArrayList<>();
ArrayList<Integer> list2 = new ArrayList<>();
ArrayList<Integer> listother = new ArrayList<>();
while (true)
{
String s = reader.readLine(); int x = 0;
if (s.isEmpty()) break; x = Integer.parseInt(s);
list.add(x);
if (x%3 == 0) list3.add(x);
if (x%2 ==0) list2.add(x);
if (x%2!=0 && x%3!=0) listother.add(x);}
//printList(list);
printList(list3);
printList(list2);
printList(listother);
}
public static void printList(List<Integer> list) {
for (int i = 0; i< list.size(); i++) System.out.println(list.get(i));//напишите тут ваш код
}
}
package com.javarush.task.task07.task0713;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Играем в Jолушку
*/
public class Solution {
public static void main(String[] args) throws Exception {
ArrayList<Integer> list = new ArrayList<>();
BufferedReader reader = new BufferedReader( new InputStreamReader (System.in));//напишите тут ваш кодBufferedReader reader = new BufferedReader( new InputStreamReader (System.in));
ArrayList<Integer> list3 = new ArrayList<>();
ArrayList<Integer> list2 = new ArrayList<>();
ArrayList<Integer> listother = new ArrayList<>();
while (true)
{
String s = reader.readLine(); int x = 0;
if (s.isEmpty()) break; x = Integer.parseInt(s);
list.add(x);
if (x%3 == 0) list3.add(x);
if (x%2 ==0) list2.add(x);
if (x%2!=0 && x%3!=0) listother.add(x);}
//printList(list);
printList(list3);
printList(list2);
printList(listother);
}
public static void printList(List<Integer> list) {
for (int i = 0; i< list.size(); i++) System.out.println(list.get(i));//напишите тут ваш код
}
}