0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

はじめに

前回
9日目です。今回からBeginnerタグをはずしてPyBegiタグにしました。PyBegiは自分が所属している勉強会です。

#9

問題

考えたこと
同じ文字列が複数あるケースがあるので、setに入れて重なりを消してからforで最大値を更新して計算しました。

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)

コード

まとめ

今回も解説が短かくなりました。では、また

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?