BOJ/백준-11656-python

cosmos·2022년 1월 6일
0
post-thumbnail

문제


풀이

  • 첫째 줄에 문자열 s가 주어진다.
  • s는 알파벳 소문자로만 이루어져 있고, 길이는 1,000보다 작거나 같다.
  • 첫째 줄부터 s의 접미사를 사전순으로 한 줄에 하나씩 출력한다.

코드

# boj, 11656:접미사 배열, python3
def solution(word):
    return '\n'.join(sorted([word[x:] for x in range(len(word))]))

if __name__ == '__main__':
    s = str(input())  # baekjoon

    print(solution(s))

결과

출처 && 깃허브

boj
github

0개의 댓글