My issue
include
include
using namespace std;
int main() {
// your code goes here
int y;
cin>>y;
while(y–){
int n,pos;
cin>>n;
string b;
cin>>b;
for(int i=0;i<n;i++){
if(b[i]=='1'){
pos=i;
break;
}
}
for(int i=pos+1;i<n;i++)b[i]='0';
cout<<b<<endl;
}
return 0;
}
wt is missing here, its saying wrong solution,anyone tell me particular case where it failing
My code
#include <iostream>
#include <string>
using namespace std;
int main() {
// your code goes here
int y;
cin>>y;
while(y--){
int n,pos;
cin>>n;
string b;
cin>>b;
for(int i=0;i<n;i++){
if(b[i]=='1'){
pos=i;
break;
}
}
for(int i=pos+1;i<n;i++)b[i]='0';
cout<<b<<endl;
}
return 0;
}
Problem Link: S100 Problem - CodeChef
wt is missing here, its saying wrong solution,anyone tell me particular case where it failing