def main():
N=int(input())
if N>=0 and N<=100:
teamList = {}
for i in range(N):
inputTeamData = input().split(';')
team1 = inputTeamData[0].strip()
team2 = inputTeamData[1].strip()
mr = inputTeamData[2].strip()
if(team1 not in teamList):
teamList[team1]=[0,0,0,0,0]
if(team2 not in teamList):
teamList[team2]=[0,0,0,0,0]
if(team1 in teamList and team2 in teamList):
teamList[team1][0]+=1
teamList[team2][0]+=1
if mr == 'win':
teamList[team1][1]+=1
teamList[team2][2]+=1
elif mr == 'loss':
teamList[team1][2]+=1
teamList[team2][1]+=1
elif mr == 'draw':
teamList[team1][3]+=1
teamList[team2][3]+=1
for team in teamList:
teamList[team][4]=teamList[team][1]*3+teamList[team][3]
for team in (sorted(teamList.items(), key = lambda points: points[1][4],reverse=True)):
ouput = f'Team: {team[0]}, Matches Played: {team[1][0]}, Won: {team[1][1]}, Lost: {team[1][2]}, Draw: {team[1][3]}, Points: {team[1][4]}'
print(ouput)
main()
Comments
Leave a comment