-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem_339A.cpp
More file actions
35 lines (32 loc) · 764 Bytes
/
Problem_339A.cpp
File metadata and controls
35 lines (32 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
string s;
cin>>s;
string ans;
vector<int> arr;
if (s.length() == 1){
cout<<s;
}else{
for (int i = 0; i < s.length(); i++)
{
if(s[i] == '+') continue;
if(s[i] == '1'){
arr.push_back(1);
}else if(s[i] == '2'){
arr.push_back(2);
}else{
arr.push_back(3);
}
}
sort(arr.begin(), arr.end());
vector<int>::iterator ele;
for(ele=arr.begin(); ele != arr.end(); ele++){
cout<< *ele;
if (ele != arr.end()-1)
cout<<"+";
}
}
return 0;
}