Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: pond4545

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

Language: cpp

Time: 0.004 second

Submitted On: 2025-10-08 09:40:31

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string phrase;
    cin >> phrase;

    for (int i = 0; i < phrase.length(); i++) 
    {
        for (int j = i + 1; j < phrase.length(); j++) 
        {
            if (phrase[j] < phrase[i]) 
            {
                char temp = phrase[i];
                phrase[i] = phrase[j];
                phrase[j] = temp;
            }
        }
    }
    string result = "";
    for (int i = 0; i < phrase.length(); i++) 
    {
        if (i == 0 or phrase[i] != phrase[i - 1])
            result += phrase[i];
    }

    for (char c : result)
        cout << c << " ";

    return 0;
}