From 2cfe84a4e6bf792d7c823c947bc4ddee437c174f Mon Sep 17 00:00:00 2001 From: leejw-lu Date: Wed, 13 Mar 2024 20:53:31 +0900 Subject: [PATCH] =?UTF-8?q?#9=209342=EB=B2=88=20=EC=97=BC=EC=83=89?= =?UTF-8?q?=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2_\354\227\274\354\203\211\354\262\264.py" | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 "\353\254\270\354\236\220\354\227\264/9342_\354\227\274\354\203\211\354\262\264.py" diff --git "a/\353\254\270\354\236\220\354\227\264/9342_\354\227\274\354\203\211\354\262\264.py" "b/\353\254\270\354\236\220\354\227\264/9342_\354\227\274\354\203\211\354\262\264.py" new file mode 100644 index 0000000..9adf8e9 --- /dev/null +++ "b/\353\254\270\354\236\220\354\227\264/9342_\354\227\274\354\203\211\354\262\264.py" @@ -0,0 +1,38 @@ +# 정규표현식 +# ^ 해당 패턴으로 시작 +# ? 해당 패턴을 0번또는 1번 +# $ 해당 패턴으로 끝 +# + 해당 패턴이 하나 이상 +# +# import re +# p=re.compile('^[A-F]?A+F+C+[A-F]?$') +# N = int(input()) +# for _ in range(N): +# k = input() +# if p.fullmatch(k): +# print('Infected!') +# else: +# print('Good') + +#### +t=int(input()) +for _ in range(t): + ss=input() + + result='Infected!' + checks=['A','B','C','D','E','F'] + pre='' + if ss[0] not in checks or ss[-1] not in checks: + result='Good' + else: + checks=['A','F','C'] + index=0 + pre='A' + for s in ss[1:-1]: + if pre!=s: + index+=1 + if checks[index]!=s: + result='Good' + break + pre=s + print(result) \ No newline at end of file