Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int n,oneCount=0,twoCount=0,threeCount=0;
- cin>>n;
- for(int i=0;i<n;i++)
- {
- int input;
- cin>>input;
- switch(input)
- {
- case 1:
- oneCount++;
- break;
- case 2:
- twoCount++;
- break;
- case 3:
- threeCount++;
- break;
- }
- }
- for(int i1=0;i1<oneCount;i1++)
- {
- cout<<"1"<<" ";
- }
- for(int i2=0;i2<twoCount;i2++)
- {
- cout<<"2"<<" ";
- }
- for(int i3=0;i3<threeCount;i3++)
- {
- cout<<"3"<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement