Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/python3.7
- # -*- coding: utf-8 -*import
- gifts = input().split()
- command = input()
- while command != 'No Money':
- command = command.split()
- if 'OutOfStock' in command:
- for word in gifts:
- if word in command:
- command = word
- gifts = [x.replace(command, str(None)) for x in gifts]
- break
- if 'Required' in command:
- gift = command[1]
- place = int(command[2])
- if len(gifts) > place >= 0:
- gifts[place] = gift
- if 'JustInCase' in command:
- gift = command[1]
- gifts.remove(gifts[-1])
- gifts.append(gift)
- command = input()
- else:
- gifts = [x for x in gifts if x != str(None)]
- s = ' '
- print(s.join(gifts))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement