Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: Newton

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-01 13:08:13

#include <bits/stdc++.h>
using namespace std;

int main(){
	int len;
	string text;
	char store;
	bool check;
	cin >> text;
	len = text.length();
	
	do{
		check = false;
		for(int i = 1; i < len; i++){
			if (int(text[i]) < int(text[i-1])){
				store = text[i];
				text[i] = text[i-1];
				text[i-1] = store;
				check = true;
			}
		}
	}while(check == true);
	
	auto last = unique(text.begin(), text.end());
    text.erase(last, text.end());
	
	for(int i = 0; i < text.length(); i++){
		cout << text[i] << " ";
	}
	return 0;
}