Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

Commit 76e0b54

Browse files
committed
20210727
1 parent 299ce1b commit 76e0b54

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
string = input().rstrip()
5+
answer = [""] * len(string)
6+
7+
def zoac(string, index):
8+
if string == "":
9+
return
10+
_min = 'a'
11+
12+
for i in range(len(string)): # ์ œ์ผ ์ž‘์€ ๊ธ€์ž & index ๊ตฌํ•˜๊ธฐ
13+
if _min > string[i]:
14+
_min = string[i]
15+
next_index = i
16+
17+
answer[index+next_index] = _min
18+
19+
print("".join(answer))
20+
21+
zoac(string[next_index+1:], index+next_index+1) # ์ œ์ผ ์ž‘์€ ๊ฐ’ ๊ธฐ์ค€ ๋‹ค์Œ ๋ฌธ์ž์—ด
22+
zoac(string[:next_index], index) # ์ œ์ผ ์ž‘์€ ๊ฐ’ ๊ธฐ์ค€ ์ด์ „ ๋ฌธ์ž์—ด
23+
zoac(string,0)

0 commit comments

Comments
ย (0)