题解 | #图片整理#
图片整理
https://www.nowcoder.com/practice/2de4127fda5e46858aa85d254af43941
#include<bits/stdc++.h>
using namespace std;
void printSet(multiset<char>& s) {
for (multiset<char>::iterator it = s.begin(); it != s.end(); it++) {
cout << *it ;
}
cout << endl;
}
int main() {
multiset<char>s1;
string str;
cin >> str;
for(int i =0;i<str.length();i++){
s1.insert(str[i]);
}
printSet(s1);
}
// 64 位输出请用 printf("%lld")
所有元素都会在插入时自动被排序
查看16道真题和解析