알고리즘
9536-백준-여우는 어떻게 울지?
easysheep
2023. 2. 6. 22:17
1. 문제 출처
https://www.acmicpc.net/problem/9536
9536번: 여우는 어떻게 울지?
각 테스트케이스마다 여우의 울음소리를 한 줄씩, 녹음된 순서대로 출력한다. 여우의 울음소리가 녹음되어 있음이 보장된다. (알려진 것과는 달리, 여우는 모스 부호로 의사소통하지 않는다.)
www.acmicpc.net
2. 풀이
# 테스트 케이스 개수
N = int(input())
for _ in range(N):
# 녹음된 것을 받는다.
record_list = input().split()
# 다른 동물의 소리를 what does the fox say?가 나올 때 까지 받는다.
other_animals = input().split()
while other_animals[0] != "what":
#만약 받은 다른 동물의 소리가 record_list에 있으면 그 값을 False 로 바꾼다.
for i in range(len(record_list)):
if record_list[i] == other_animals[2]:
record_list[i] = False
other_animals = input().split()
# False 인 값을 제외하고 출력한다.
for fox_say in record_list:
if fox_say:
print(fox_say , end = " ")