Back
Close

Emoji vending machine

Statement

 Goal

You were about to send a text message to your loved one but disaster stroke! You realized you are all out of heart emojis! Conveniently, there's a vending machine nearby where you can restock.

Each emoji has a price so you might have to send only two heart emojis instead of the usual three.


Modify the message according to the funds you have available in your wallet and the current prices of the emojis in your message. You buy the emojis in the order they appear in your message, leaving the ones you can't afford out of your message.

The trailing spaces must be stripped from the resulting message if an emoji was removed at the end.
Input
Line 1: M The message you want to send to your loved one.
Line 2: F The funds in your wallet.
Line 3: N The number of emojis sold in the vending machine.
Next N Lines, E and P: Emoji and its price separated with a space.
Output
Line 1: The message minus the emojis you can't afford.
Constraints
1 ≤ N ≤ 5
0.00 ≤ F ≤ 999.99
0.01 ≤ P ≤ 9.99
Example
Input
Hello love ❤❤❤
2.00
1
❤ 1.00
Output
Hello love ❤❤

Game modes
Fastest, Shortest

Test cases
Missing a heart Test
Input
Hello love ❤❤❤ 2.00 1 ❤ 1.00
Output
Hello love ❤❤

Missing a heart validator Validator
Input
Good morning love ❤❤❤ 4.00 1 ❤ 1.50
Output
Good morning love ❤❤

Insufficient funds Test
Input
Don't forget to give the 🥫 to the 🐈 at 🕛 3.52 3 🥫 2.25 🐈 1.35 🕛 3.00
Output
Don't forget to give the 🥫 to the at

Insufficient funds Validator Validator
Input
Did you give the 🥫🥫s to the 🐈 at 🕛? 5.12 3 🥫 2.25 🐈 1.50 🕛 2.50
Output
Did you give the 🥫🥫s to the at ?

Expensive emoji Test
Input
I saw a 🦒 and a 🐪 at the zoo today! 6.50 2 🦒 9.50 🐪 6.50
Output
I saw a and a 🐪 at the zoo today!

Expensive emoji validator Validator
Input
There were no 🦒, just 🦏s at the zoo 3.65 2 🦒 7.25 🦏 3.65
Output
There were no , just 🦏s at the zoo

Lots Of Love Test
Input
❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤💙💙💙 0.27 2 ❤ 0.05 💙 0.01
Output
❤❤❤❤❤💙💙

Lots Of Love validator Validator
Input
❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤💙💙💙 0.19 2 ❤ 0.06 💙 0.01
Output
❤❤❤💙

Solution language

Solution

Stub generator input