-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1369B.cpp
46 lines (46 loc) · 894 Bytes
/
1369B.cpp
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
36
37
38
39
40
41
42
43
44
45
46
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long int n;
cin>>n;
string s,a;
cin>>s;
a=s;
sort(a.begin(),a.end());
if(a.compare(s)==0)
{
cout<<a<<endl;
}
else
{
long long int i=0;
while(s[i]!='1')
{
i++;
}
i++;
long long int j=s.length()-1,count=0;
while(s[j]!='0')
{
j--;
count++;
}
while(i>0)
{
cout<<"0";
i--;
}
while(count>0)
{
cout<<"1";
count--;
}
cout<<endl;
}
}
}