Last time It's the 9th day. From this time, I removed the Beginner tag and made it a PyBegi tag. PyBegi is a study group to which I belong.
#9 Problem
** Thoughts ** Since there are cases where there are multiple same character strings, I put them in set to eliminate the overlap, and then updated the maximum value with for to calculate.
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
s_set = set(s)
t_set = set(t)
ans = 0
for i in s_set:
p = s.count(i)
q = t.count(i)
ans = max(ans,p-q)
print(ans)
The commentary has become shorter this time as well. see you
Recommended Posts