#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int compare(const void *a,const void *b) {
    return strcmp((char *)a, (char *)b);
}
char str1[1001][1005];
int main() {
    char str[1005];
    scanf("%s",str);
    //문자열 한줄 반복
    for(int i=0; str[i]; i++) {
        int k=0;
        for(int j=i; str[j]; j++) {
            str1[i][k++]=str[j];
        }
        str1[i][k]='\0';
    }
    
    qsort(str1,strlen(str),sizeof(str1[0]),compare);
    for(int i=0; str[i]; i++) {
        printf("%s\n",str1[i]);
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: