====== 크게 만들기 ====== ===== 풀이 ===== * [[ps:problems:programmers:42883]]과 동일한 문제. 풀이는 그쪽을 참고. ===== 코드 ===== """Solution code for "BOJ 2812. 크게 만들기". - Problem link: https://www.acmicpc.net/problem/2812 - Solution link: http://www.teferi.net/ps/problems/boj/2812 Tags: [Stack] """ INF = float('inf') def main(): N, K = [int(x) for x in input().split()] num = input() stack = [] removed_count = 0 for ch in num: while stack and removed_count < K and stack[-1] < ch: stack.pop() removed_count += 1 stack.append(ch) print(''.join(stack[:N - K])) if __name__ == '__main__': main() {{tag>BOJ ps:problems:boj:골드_4}}