Submission

Status:

[PPPP-SSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: Chita

Problemset: เรียงสตริง

Language: c

Time: 0.002 second

Submitted On: 2025-10-13 19:17:00

#include <stdio.h>

int main(void){
    char str[30], str2[30];
    int top=-1;
    gets(str);
    for (int i=0;str[i];i++){
        if (str[i]<'A'||(str[i]>'Z'&&str[i]<'a')||str[i]>'z') continue;
        int duped=0;
        for (int j=0;str2[j];j++){
            if (str2[j] == str[i]){
                duped=1;
                break;
            }
        }
        if (duped==0){
            top++;
            str2[top] = str[i];
        } 
    }
    // Sorting
    for (int i=0;i<top;i++){
        for (int j=0;j<top-i;j++){
            if (str2[j]>str2[j+1]){
                char temp = str2[j];
                str2[j] = str2[j+1];
                str2[j+1] = temp;
            }
        }
    }
    // Printing
    for (int i=0;str2[i];i++){
        printf("%c ", str2[i]);
    }
    return 0;
}