num = int(input()) stack = [] for i in range(num): stack.append([]) stack[i] = input().split(" ") for j in range(num): for x in range(len(stack[j])): print(stack[j][x][::-1]+" ",end='') if j != num-1: print("")
알고리듬
백준 기초 스택 문제 import sys N = int(input()) stack = [] def push(X): stack.append(X) def pop(): if len(stack)==0: print(-1) else: print(stack.pop()) def empty(): if len(stack)==0: print(1) else: print(0) def size(): print(len(stack)) def top(): if len(stack)==0: print(-1) else: print(stack[len(stack)-1]) for i in range(N): commend = sys.stdin.readline().split() if commend[0]=="push": push(commend[1])..