-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathSUSSTR.cpp
More file actions
39 lines (33 loc) · 744 Bytes
/
SUSSTR.cpp
File metadata and controls
39 lines (33 loc) · 744 Bytes
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
#include <iostream>
using namespace std;
int main() {
// your code goes here
int number;
cin >> number;
for(int i =0; i < number; i++){
int temp;
cin>>temp;
string test;
cin>> test;
string newstring="";
int x=0;
int y=temp-1;
while(x<=y){
if(test[x]=='0'){
newstring=test[x]+newstring;
}
else
newstring=newstring+test[x];
if(x<y){
if(test[y]=='0')
newstring=newstring+test[y];
else
newstring=test[y]+newstring;
y--;
}
x++;
}
cout<<newstring<<endl;
}
return 0;
}