cswork / OA打开练习工作台

IBMOA #9

Remove Even-Value Nodes from Linked List

估计简单可在线判题

考点(AI 标注)链表

Delete all nodes with even values from a singly linked list, keep the remaining nodes in their original order, and return the full list.

输入格式

The first line contains n, and the second line contains n node values. On this site 0≤n≤200000, −10^9≤value≤10^9.

输出格式

Output the number of remaining nodes on the first line and the node values in list order on the second line; for an empty list the second line may be empty.

样例 1

输入:

7
1 2 3 4 5 6 7

输出:

4
1 3 5 7

样例 2

输入:

2
2 4

输出:

0

样例 3

输入:

4
-2 -3 0 5

输出:

2
-3 5

样例说明

The output counts and sequences are: 4 and 1 3 5 7; 0; 2 and −3 5.