#C3770. Manage Character Inventory
Manage Character Inventory
Manage Character Inventory
Given a list of currently carried weapons and a list of new available weapons along with a limit \(L\) on the maximum number of weapons a character can carry, your task is to determine the final inventory of weapons.
You should add weapons from the new list to the current list one by one until the inventory reaches the size \(L\). The order of the weapons must be preserved. If the number of weapons in the current list is already \(\ge L\), no new weapons are added.
inputFormat
The input is read from standard input (stdin) and consists of three lines:
- The first line contains the names of the currently carried weapons separated by spaces (it may be an empty line if there are none).
- The second line contains the names of the new available weapons separated by spaces (or an empty line if there are none).
- The third line contains an integer \(L\) representing the maximum number of weapons the character can carry.
outputFormat
The output is printed to standard output (stdout) as a single line with the final inventory's weapon names separated by spaces.
## samplesword dagger
bow axe
3
sword dagger bow