#BS0000073. Hamburger (Hamburgers)
Hamburger (Hamburgers)
Hamburgers
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A recipe string contains B, S, and C. Current stocks are , unit prices are , the store has unlimited supply, and you have money. Find the maximum number of hamburgers that can be produced.
Input
Input contains the recipe, stocks, prices, and money.
Output
Print the maximum number of hamburgers.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: recipe length , stocks/prices , .
Example
Input
BBBSSC
6 4 1
1 2 3
4
Output
2
Explanation
Two hamburgers require buying only one extra cheese unit.