Write the method removeNegatives(ArrayList<Integer> list). It removes every negative number from the list itself (it returns nothing). Zero is not negative, so zeros stay. The other numbers keep their order.
The first line has n. The second line has the n integers.
On the first line print the numbers that are left, separated by one space, or empty if no number is left. On the second line print Count: and how many numbers are left.
Input:
5
-1 -2 -3 5 -4
Output:
5
Count: 1

Write the method `removeNegatives(ArrayList<Integer> list)`. It removes every negative number from the list itself (it returns nothing). Zero is not negative, so zeros stay. The other numbers keep their order. ### Input Format The first line has `n`. The second line has the `n` integers. ### Output Format On the first line print the numbers that are left, separated by one space, or `empty` if no number is left. On the second line print `Count: ` and how many numbers are left. ### Example Input: ``` 5 -1 -2 -3 5 -4 ``` Output: ``` 5 Count: 1 ``` Write the method `countWords(ArrayList<String> words)`. It returns a `HashMap<String, Integer>` that says how many times each word appears in the list. Capital and small letters are different, so `Tea` and `tea` are two different words. The main code then answers some questions about how many times a word appeared. A word that is not in the list appeared 0 times. ### Input Format The first line has `n`. The second line has the `n` words. The third line has `q`, the number of questions. The fourth line has `q` words to ask about. ### Output Format For each asked word print one line: the word, a space and the number of times it appears. ### Example Input: ``` 3 a a a 1 a ``` Output: ``` a 3 ``` Write the method `distinctSorted(ArrayList<Integer> list)`. It returns a `TreeSet<Integer>` that holds every different number of the list once. A `TreeSet` keeps its numbers in increasing order by itself. The main code prints the numbers, how many there are, the smallest and the largest. The list always has at least one number. ### Input Format The first line has `n`. The second line has the `n` integers. ### Output Format First line: the different numbers in increasing order, separated by one space. Then `Distinct: ` and how many. Then `Smallest: ` and the smallest. Then `Largest: ` and the largest. ### Example Input: ``` 3 -4 -4 -4 ``` Output: ``` -4 Distinct: 1 Smallest: -4 Largest: -4 ```