Help me in solving S100 problem

My issue

Hello ,
can anyone help me find the mistake in this code ,this is a problem from starters 100 div 3 stamps100,I am not able to understand where is the fault.

My code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
void ans(){
    ll n; cin>>n;
    string s;
    cin>>s;
    for(ll i=n-3;i>=0;i--){
        if(s[i]=='1'){
            s[i+1]='0';
            s[i+2]='0';
        }
    }
    cout<<s<<endl;
}
int main(){
ll t;
cin>>t;
while(t--){
ans();
}
return 0;
}

Problem Link: S100 Problem - CodeChef

@iamaroy
Your logic is not right.
Plzz refer the following code for better understanding of the logic.

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    string s;
	    cin>>s;
	    for(int i=0;i<n-2;i++)
	    {
	        if(s[i]=='1')
	        {
	            i++;
	            while(i<n)
	            {
	                s[i]='0';
	                i++;
	            }
	        }
	    }
	    cout<<s<<endl;
	}
	return 0;
}