All problems

Library Fine Slips

Easy · array

At the end of the month a library prints a reminder slip for each member who owes a fine. You are given the list fines, where each item is the amount one member owes, in pence, in the order the members appear on the register.

Work out the amounts to print:

Return the list of amounts to print, in the same order as in fines. If nobody gets a slip, return an empty list.

Examples

Example 1

Input: fines = [0, 45, 250, 0, 99, 100]

Output: [65, 250, 119, 100]

The two 0s are left out. 45 becomes 65 and 99 becomes 119. 250 and 100 stay the same.

Example 2

Input: fines = [0, 0]

Output: []

Example 3

Input: fines = [7]

Output: [27]

Constraints