SWEA 1234 [S/W 문제해결 기본] 10일차 - 비밀번호
·
CodingTest
for test_case in range(1, 11): stack = [] n, nums = input().split() nums = list(nums.strip()) for num in nums: if not stack: stack.append(num) else: if stack[-1] == num: stack.pop() else: stack.append(num) print('#' + str(test_case), ''.join(stack))