team1, r1, team2, r2= input().split(';')
import collections
results = collections.defaultdict(list)
n = int(input())
for _ in range(n):
team1, score1, team2, score2 = input().strip().split(';')
score1 = int(score1)
score2 = int(score2)
if score1 == score2:
results[team1].append(1)
results[team2].append(1)
continue
if score1 > score2:
results[team1].append(3)
results[team2].append(0)
else:
results[team2].append(3)
results[team1].append(0)
for team, scores in results.items():
games = str(len(scores))
wins = str(scores.count(3))
draws = str(scores.count(1))
loses = str(scores.count(0))
total = str(sum(scores))
print('%s:%s' % (team, ' '.join((games, wins, draws, loses, total))))
import collections
genome = 'aaaabbcaa'
result = collections.deque()
genome += '$'
last = genome[0]
counter = 1
for c in genome[1:]:
if c == last:
counter += 1
else:
result.append('%s%d' % (last, counter))
last = c
counter = 1
print(''.join(result))
handlers = {
'ADD': lambda x: print('ADD with %s' % x),
'DELETE': lambda x: print('DELETE with %s' % x),
'INSERT': lambda x: print('INSERT with %s' % x)
}
for _ in range(int(input())):
handler_name, arg = input().split()
handler = handlers.get(
handler_name, lambda _: print("%s wasn't found" % handler_name)
)
handler(arg)
% cat input.txt
4
DELETE 10
INSERT 2
ADD 15
SELECT 7
% python3 ans.py < input.txt
DELETE with 10
INSERT with 2
ADD with 15
SELECT wasn't found