Help me in solving S100 problem

My issue

Can anyone explain me why my code is not working?

My code

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
void solution()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i=0;i<s.length()-2;i++)
    {
        string temp=s.substr(i,3);
        if(temp>"100")
        {
            s[i]='1';
            s[i+1]='0';
            s[i+2]='0';
        }
    }
    cout << s << endl;
}

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        solution();
    }
    return 0;
}

Problem Link: S100 Problem - CodeChef

@gudhi987
Your logic is not right .
Plzz refer the following solution for better understanding of the logic.

#include <iostream>
using namespace std;

int main() {
    int test;
    cin>>test;
    while(test--){
        int x;
        cin>>x;
        string s;
        cin>>s;
        bool y=true;
        string ans="";
        for(int i=0;i<x-2;i++){
            if(s.at(i)=='1'&&y){
                ans+="1";
                y=false;
            }
            else
                ans+="0";
        }
        ans+="00";
        cout<<ans<<endl;
    }
    return 0;
}