Question: 1. Match buying and selling of stocks and output in the below format
Constraints:
Example: "p1 sell s1 1500 200 rs" order will be executed like this - "p3:s1:600:200" and "p4:s1:900:200" since p3 buyer come before p4.Example: "p22 buy s4 200 300 rs" has two available option: 1. buy s4 from p20 for 100 rs or 2. buy s4 from p21 for 150 rs . In this case buyer should go with p20 for 100 rs . Example: "p2 buy s2 800 500 rs" and "p23 buy s2 900 650 rs" comes before "p10 sell s2 1000 400 rs"Input: String
<person tradeType stock quantity price currency>
"p1 sell s1 1500 200 rs"
"p2 buy s2 800 500 rs"
"p3 buy s1 600 250 rs"
"p4 buy s1 1200 270 rs"
"p5 sell s3 300 800 rs"
"p6 sell s3 100 750 rs"
"p7 buy s3 500 900 rs"
"p21 sell s4 200 150 rs"
"p20 sell s4 200 100 rs"
"p22 buy s4 200 300 rs"
"p23 buy s2 900 650 rs"
"p10 sell s2 1000 400 rs"
Output - Trades - String
"p3:s1:600:200"
"p4:s1:900:200"
"p7:s3:100:750"
"p7:s3:300:800"
"p22:s4:200:100"
"p2:s2:800:400"
"p23:s2:200:400"
Time given: 1 Hr