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