Submission
Status:
[PP-SSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: vachirasawin
Problemset: เรียงสตริง
Language: c
Time: 0.001 second
Submitted On: 2025-10-11 23:54:05
// POSN Computer 67 | Final Camp
// Exam Bank
// C Programming | finalCamp67_1.c
#include <stdio.h>
int main() {
char str[31], temp;
int i, j, count = 0;
scanf("%s", str);
while (str[count] != '\0') count++;
for (i = 0; i < count - 1; i++) {
for (j = 0; j < count - i - 1; j++) {
if (str[j + 1] < str[j]) {
temp = str[j];
str[j] = str[j + 1];
str[j + 1] = temp;
} else if (str[j + 1] == str[j]) {
str[j + 1] = '\0';
}
}
}
for (i = 0; i < count; i++) {
if (str[i] != '\0') printf("%c ", str[i]);
}
return 0;
}