A - Probably English Editorial by Tomii9273
ループを使わずに解答することもできます。
「入力文字列のリスト」と「問題文の5単語」に共通して存在する単語の集合を、set 型での集合演算を用いて求めます。
その集合が空でないならば答えは Yes
、空であるならば No
です。
実装例 (Python)
N = int(input())
W = list(input().split()) # 入力文字列のリスト
common = set(W) & set(["and", "not", "that", "the", "you"]) # 「W」と「問題文の5単語」に共通して存在する単語の集合
# print(common)
if len(common) > 0:
print("Yes")
else:
print("No")
posted:
last update: