| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
- Python
- 2750
- Numpy
- centuryFromYear
- flask
- C++
- Daily Commit
- markdown
- data_structure
- adjacentElementsProduct
- Counting cells in a blob
- 백준
- matrixElementsSum
- collections.deque
- baekjun
- shapeArea
- 수 정렬하기
- cpp
- 피보나치 수
- codesignal
- 파이썬 포렌식
- 파이썬머신러닝완벽가이드
- almostIncreasingSequence
- recursion
- All Longest Strings
- Sequential Search
- 10953
- codesingal
- 2015 봄학기 알고리즘
- til
- Today
- Total
Introfor
from sys import stdin if __name__ == '__main__': l_stack = list(stdin.readline().rstrip()) r_stack = [] cnt = int(stdin.readline()) for cmd in stdin: if cmd[0] == 'L' and l_stack: r_stack.append(l_stack.pop()) if cmd[0] == 'D' and r_stack: l_stack.append(r_stack.pop()) if cmd[0] == 'B' and l_stack: l_stack.pop() if cmd[0] == 'P': l_stack.append(cmd[2]) print(''.join(l_stack+r_stack[::-1])) 백준 강의..
기본적인 자료구조인 스택 관련 문제로 백준 사이트에 있는 문제를 풀어보았다. __author__ = 'hanayong' stack = [] def push(word): global stack for _ in range(len(word)): stack.append(word.pop()) def pop(): global stack if stack in []: return else: return stack.pop() def reserve_words(): global stack word_list = [] for _ in range(len(stack)): word_list.append(pop()[::-1]) print(' '.join(word_list)) if __name__ == '__main__': n = in..