알고리즘
[백준] 1251번 단어 나누기 python
_Myway
2023. 5. 18. 21:02
word = input()
a=''
b=''
c=''
answer = []
for i in range(1,len(word)-1):
for j in range(i+1,len(word)):
a = word[0:i]
b = word[i:j]
c = word[j:len(word)]
answer.append(a[::-1]+b[::-1]+c[::-1])
print(sorted(answer)[0])