Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: indy

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-01 20:30:32

#include <stdio.h>
#include <string.h>

int main() {
    char str[35];
    scanf("%s",str);
    int n = strlen(str);

    for (int i = 0; i < n;i++){
        for (int j = 0; j < n-1;j++){
            if (str[j] > str[j+1]){
                char temp = str[j];
                str[j] = str[j+1];
                str[j+1] = temp;
            }
        }
    }

    printf("%c ", str[0]);
    for (int i = 1;i < n;i++){
        if (str[i] == str[i-1]) continue;
        printf("%c ", str[i]);
    }
    return 0;
}