Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<string>
- #include <algorithm>
- using namespace std;
- void process(int array[250] , int length){
- sort(array , array + length);
- for(int i = 0 ; i < length ; i++){
- cout << array[i];
- if(i == length - 1){
- break;
- }
- cout << "+";
- }
- }
- int main() {
- string series;
- int countPlus = 0;
- int array[250];
- cin >> series;
- int length = series.length();
- if(length <= 100){
- for(int i = 0 ; i < length ; i++){
- if(series.at(i) == '+'){
- countPlus++;
- }
- if(series.at(i) != '+'){
- array[i - countPlus] = series.at(i) - 48;
- }
- }
- int len = length - countPlus;
- process(array , len);
- }else{
- exit(0);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment