Problem list
Log in
#r03078 · Online Judge > GoldOJ

Pop From a List

Bronze II 2.0 s 1024 MB

A list of integers is given. Then $Q$ indices follow, each always valid for the current list (negative indices allowed). For each index remove and print the popped value (one per line), then on the last line print the final list as a Python list literal.

Input

Line 1: the list. Line 2: $Q$. Next $Q$ lines: an index each.

Output

Print each popped value, then the final list.

Example 1

Input
10 20 30 40 50
3
1
-1
0
Output
20
50
10
[30, 40]
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code