Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     char s[105];
  7.  
  8.     scanf("%s", s);
  9.     int l = strlen(s);
  10.     int t = 0;
  11.     int n[l];
  12.     for(int i = 0; i<l; i+=2)
  13.     {
  14.      n[t] = s[i]-'0';
  15.      t++;
  16.     }
  17.     sort(n, n+t);
  18.  
  19.     for(int i = 0; i<t; i++)
  20.     {
  21.        if(i==t-1)
  22.        {
  23.         printf("%d", n[i]);
  24.        }
  25.        else
  26.        {
  27.         printf("%d+", n[i]);
  28.        }
  29.     }
  30.  
  31.  
  32.  
  33.  
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement