BOJ - 2993 - 세 부분

Updated:

import sys

def solution():
    word = str(input())
    data = []

    for i in range(1, len(word)):
        for j in range(i+1, len(word)):
            a, b, c = word[0:i], word[i:j], word[j:]
            data.append(
                a[::-1] + b[::-1] + c[::-1]
            )
    data.sort()
    print(data[0])


solution()

https://www.acmicpc.net/problem/2993

Categories:

Updated:

Leave a comment