4X
2024-08-25 21:07:14
发布于:云南
5阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
vector<char> xiao;
vector<char> da;
vector<char> shu;
vector<char> other;
int main(){
string s; cin >> s;
int l = s.size();
for(int i = 0;i < l;i++){
if(s[i] >= 'a' && s[i] <= 'z') xiao.push_back(s[i]);
else if(s[i] >= 'A' && s[i] <= 'Z') da.push_back(s[i]);
else if(s[i] >= '0' && s[i] <= '9') shu.push_back(s[i]);
else other.push_back(s[i]);
}
sort(xiao.begin(),xiao.end());
sort(da.begin(),da.end());
sort(shu.begin(),shu.end());
sort(other.begin(),other.end());
for(int i = 0;i < xiao.size();i++) cout << xiao[i];
for(int i = 0;i < da.size();i++) cout << da[i];
for(int i = 0;i < shu.size();i++) cout << shu[i];
for(int i = 0;i < other.size();i++) cout << other[i];
return 0;
}
这里空空如也
有帮助,赞一个