Company: Walmart sparkplug
Difficulty: medium
Optimized Postfix Evaluation You're given a mathematical expression represented as a string in postfix notation. The expression contains operands (single-digit numbers) and operators (+, -, *, /). You need to evaluate the expression while considering an additional cost associated with each operation. You also have the option to "optimize" any single operation exactly once at a fixed cost, reducing the cost of that operation to zero and replacing it with the optimization cost. Addition (+): Cost a Subtraction (-): Cost b Multiplication (*): Cost c Division (/): Cost d Optimization cost: Cost e (the fixed cost to reduce any single operation's cost to zero and replacing it with the cost e ) (where a , b , c , d , and e are positive integers) Input Format The first line contains a string representing the postfix expression. The second line contains five space-separated integers representing the costs a , b , c , d , and e . Output Format Print two space-separated integers which represent t