본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 30266번 Hurricane Warning

by 현장 2024. 7. 1.

-Code

from sys import stdin
input = stdin.readline

for t in range(int(input())):
    n = int(input())
    media = set(input().strip("\n"))
    res = 0

    for _ in range(n):
        line = input()
        for el in media:
            if el in line:
                res += 1
                break

    print(f"Data Set {t + 1}:")
    print(res)
    print()