본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 8965번 Circular Sequence

by 현장 2024. 1. 22.

-Code

for _ in range(int(input())):
    line = input()
    res = line
    for i in range(len(line)):
        temp = line[i:] + line[:i]
        if res > temp:
            res = temp

    print(res)