9996๋ฒ/ํ๊ตญ์ด ๊ทธ๋ฆฌ์ธ ๋ ์๋ฒ์ ์ ์ํ์ง/recomplie()
https://my-coding-notes.tistory.com/228
[๐ฅ3 / ๋ฐฑ์ค 9996 / ํ์ด์ฌ] ํ๊ตญ์ด ๊ทธ๋ฆฌ์ธ ๋ ์๋ฒ์ ์ ์ํ์ง
9996๋ฒ: ํ๊ตญ์ด ๊ทธ๋ฆฌ์ธ ๋ ์๋ฒ์ ์ ์ํ์ง ์ด N๊ฐ์ ์ค์ ๊ฑธ์ณ์, ์ ๋ ฅ์ผ๋ก ์ฃผ์ด์ง i๋ฒ์งธ ํ์ผ ์ด๋ฆ์ด ํจํด๊ณผ ์ผ์นํ๋ฉด "DA", ์ผ์นํ์ง ์์ผ๋ฉด "NE"๋ฅผ ์ถ๋ ฅํ๋ค. ์ฐธ๊ณ ๋ก, "DA"๋ ํฌ๋ก์ํฐ์ด์ด๋ก "YES"
my-coding-notes.tistory.com
https://my-coding-notes.tistory.com/228
[๐ฅ3 / ๋ฐฑ์ค 9996 / ํ์ด์ฌ] ํ๊ตญ์ด ๊ทธ๋ฆฌ์ธ ๋ ์๋ฒ์ ์ ์ํ์ง
9996๋ฒ: ํ๊ตญ์ด ๊ทธ๋ฆฌ์ธ ๋ ์๋ฒ์ ์ ์ํ์ง ์ด N๊ฐ์ ์ค์ ๊ฑธ์ณ์, ์ ๋ ฅ์ผ๋ก ์ฃผ์ด์ง i๋ฒ์งธ ํ์ผ ์ด๋ฆ์ด ํจํด๊ณผ ์ผ์นํ๋ฉด "DA", ์ผ์นํ์ง ์์ผ๋ฉด "NE"๋ฅผ ์ถ๋ ฅํ๋ค. ์ฐธ๊ณ ๋ก, "DA"๋ ํฌ๋ก์ํฐ์ด์ด๋ก "YES"
my-coding-notes.tistory.com
import re, sys
input = sys.stdin.readline
n = int(input())
s,e = input().rstrip().split("*")
pt = re.compile(s+".*"+e+"+")
for i in range(n):
string = input().rstrip()
a = pt.search(string)
if a and a.group() == string:
print("DA")
else:
print("NE")