IPL Match Details
Write a program that reads all the match outcomes and summarizes the information of all the matches.
Points are given to the teams based on the outcome of the match.
A win earns a team 3 points. A draw earns 1. A loss earns 0.
The following information is expected:
MP: Matches Played
W: Matches Won
D: Matches Drawn (Tied)
L: Matches Lost
P: Points. The team information should be displayed in descending order of points. Constraints: Names of teams may contain spaces but will be less than 24 characters
100 >= N >= 0.
input:6
CSK;RR;loss
RR;DD;draw
MI;KKR;win
KKR;RR;loss
CSK;DD;draw
MI;DD;draw
output:Team: RR, Matches Played: 3, Won: 2, Lost: 0, Draw: 1, Points: 7
Team: MI, Matches Played: 2, Won: 1, Lost: 0, Draw: 1, Points: 4
Team: DD, Matches Played: 3, Won: 0, Lost: 0, Draw: 3, Points: 3
Team: CSK, Matches Played: 2, Won: 0, Lost: 1, Draw: 1, Points: 1
Team: KKR, Matches Played: 2, Won: 0, Lost: 2, Draw: 0, Points: 0
Sample output:
CSK;RR;loss
RR;DD;draw
MI;KKR;win
KKR;RR;loss
CSK;DD;draw
MI;DD;draw
Team: RR, Matches Played: 3, Won: 2, Lost: 0, Draw: 1, Points: 7
Team: MI, Matches Played: 2, Won: 1, Lost: 0, Draw: 1, Points: 4
Team: DD, Matches Played: 3, Won: 0, Lost: 0, Draw: 3, Points: 3
Team: CSK, Matches Played: 2, Won: 0, Lost: 1, Draw: 1, Points: 1
Team: KKR, Matches Played: 2, Won: 0, Lost: 2, Draw: 0, Points: 0
Comments
Leave a comment