문제
풀이
문자열을 받아 각 자릿수를 비교해서 정렬하면 된다.
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string str;
cin >> str;
sort(str.begin(), str.end(), greater<char>());
cout << str;
return 0;
}
'백준 > 정렬' 카테고리의 다른 글
11651번 좌표 정렬하기 2 [C++] (0) | 2023.03.27 |
---|---|
11650번: 좌표 정렬하기 [C++] (0) | 2023.03.27 |
2108번: 통계학 [C++] (0) | 2023.03.27 |
10989번: 수 정렬하기 3 [C++] (0) | 2023.03.27 |
2751번: 수 정렬하기 2 [C++] (0) | 2023.03.27 |