import sys
for _ in range(int(input())):
left = []
right = []
input = sys.stdin.readline()
for c in input :
if c == "<":
if left :
right.append(left.pop())
elif c == ">":
if right :
left.append(right.pop())
elif c == "-":
if left :
left.pop()
else :
left.append(c)
left.extend(right)
print("".join(list(left)))'Algorithm > 기본 알고리즘' 카테고리의 다른 글
| leetcode 24. Swap Nods in Pairs (0) | 2023.01.21 |
|---|---|
| boj-1931. 회의실배정 (0) | 2023.01.20 |
| boj-7785. 회사에있는사람 (0) | 2023.01.20 |
| boj-2164. 카드 2 (0) | 2023.01.19 |
| boj-11866. 요세푸스 문제 (0) | 2023.01.19 |