728x90
반응형
기본적인 스택 문제이다.
from collections import deque
for case in range(int(input())):
stack = deque(input().split())
print(f"Case #{case+1}: ", end='')
while len(stack) > 1:
print(stack.pop(), end= ' ')
print(stack.pop())
728x90
반응형
'Agorithm > 백준 알고리즘' 카테고리의 다른 글
백준 알고리즘 20001번 고무오리 디버깅(python) (0) | 2021.03.06 |
---|---|
백준 알고리즘 17952번 과제는 끝나지 않아!(python) (0) | 2021.03.06 |
백준 알고리즘 20301번 반전 요세푸스(python) (0) | 2021.03.06 |
백준 알고리즘 18115번 카드 놓기(python) (0) | 2021.03.06 |
백준 알고리즘 13417번 카드 문자열(python) (0) | 2021.03.06 |