SHARE
TWEET

task 2( ds lab 3) 3rd sem

Adrita Jan 22nd, 2020 (edited) 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     string str;
  6.     int str2[100];
  7.     int i,j;
  8.     cin>>str;
  9.     for(i=0,j=0; i<str.size(); i=i+2,j++)
  10.     {
  11.         str2[j]=str[i]-'0';
  12.     }
  13.     sort(str2,str2+j);
  14.     for(i=0; i<j; i++)
  15.     {
  16.         if(i==j-1)
  17.             cout<<str2[i];
  18.         else
  19.             cout<<str2[i]<<"+";
  20.     }
  21.  
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top