文章
55
粉丝
100
获赞
12
访问
31.0k
#include <iostream>
#include <vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
string str;
cin>>str;
int len = str.length();
int arr[1000] = {0};
int st = 0;
string s = "";
for(int i = 0; i<len; i++){
if(str[i] != ','){
s+=str[i];
}else{
arr[st++] = stoi(s);
s = "";
}
}
string hh = "";
for(int i = len-1; i>=0; i--){
if(str[i] != ','){
hh+=str[i];
}else{
break;
}
}
string ha = "";
int len1 = hh.length();
for(int i = len1-1; i>=0; i--){
ha+=hh[i];
}
arr[st] = stoi(ha);
sort(arr,arr+st+1);
for(int i = 0; i<=st; i++){
if(i%4==0 && i!=0){
cout<<endl;
}
cout<<arr[i]<<" ";
}
}
登录后发布评论
暂无评论,来抢沙发