Solution

import sys
from typing import List


def solution(word: str) -> List[str]:
    answer = []

    for i in range(len(word)):
        answer.append(word[i:len(word) + 1])

    return sorted(answer)


s = sys.stdin.readline().rstrip()
print(*solution(s), sep='\n')

Leave a comment