Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: opjns

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-13 08:14:02

#include <iostream>
using namespace std;
int main ()  {
    char word[101],temp;
    cin >> word;
    int len=0;
    while(word[len]!='\0') {
        len++;
    }
    for(int i =0;i<len-1;i++) {
        for(int j = 0; j<len-i-1;j++){
            if(word[j]>word[j+1]) {
                temp= word[j];
                word[j] = word[j+1];
                word[j+1] = temp;
            }
        }
    }
    for (int i = 0; i < len; i++) {
        if (i == 0 || word[i] != word[i - 1]) {
            cout << word[i];
            if (i != len - 1 ) {
                cout << " ";
            }
        }
    }

    return 0;
}