Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gifts = list(map(str, input().split(' ')))
- while True:
- command = input()
- if command == 'No Money':
- break
- command = command.split(' ')
- if command[0] == 'OutOfStock':
- for el in gifts:
- if el == command[1]:
- gifts[gifts.index(el)] = None
- elif command[0] == 'Required':
- req = int(command[2])
- if -len(gifts) <= req < len(gifts):
- gifts[req] = command[1]
- elif command[0] == 'JustInCase':
- gifts[-1] = command[1]
- for el in gifts:
- if el is None:
- gifts.remove(el)
- print(*gifts)
Advertisement
Add Comment
Please, Sign In to add comment