Problem

2/10

Adding an element

Theory Click to read/hide

There are two options for adding an element to an ArrayList:
add(value);  - adding a value to the end of the ArrayList
add(index, value); - adding a value to the right place by index.

For example:

arr.add(10);
arr.add(5,10); 
 

Problem

Create an integer ArrayList and fill it with only positive elements.

Input: The first line contains the number of elements in the array. The second line contains the elements of the array.

Output: print only positive elements from the sequence.
 
Examples
# Input Output
1 4
2 -4 0 100
2 100