Divisible by 8 contest question

here is the problem link
my code goes as

int main() {
// your code goes here
int t;cin>>t;
while(t–){
int n;cin>>n;
string s;cin>>s;
string num = “”;
if(n < 3){
for(char i:s){
num += i;
}
}
else{
num += s[n-3];
num += s[n-2];
num += s[n-1];
}
int x = num.size();
int ei = stoi(num);
int eu = ei;
int y = ei%8;
if(ei%8 == 0){
cout<<s<<endl;
}
else{
ei += (8-y);
eu -= y;
string ans;
string ou = to_string(eu);
int du = 0;
while(ou.size() < x){
ou = ‘0’ + ou;
}
for(int i=0;i<num.size();i++){
if(ou[i] != num[i]) du++;
}
if(du != 1){
ou = to_string(ei);
while(ou.size() < x){
ou = ‘0’ + ou;
}
if(n<3){
cout<<ou<<endl; continue;
}
// cout<<ou<<endl;
s[n-3] = ou[0];
s[n-2] = ou[1];
s[n-1] = ou[2];
cout<<s<<endl;
continue;
}
if(n<3){
cout<< ou<<endl;continue;
}
// cout<< ou<<endl;
s[n-3] = ou[0];
s[n-2] = ou[1];
s[n-1] = ou[2];
cout<<s<<endl;

    }
    
}
return 0;

}

why it is wrong?? can anyone help me out here pls

codechef.com/viewsolution/1025297287
Visit here. There, I explained this problem. I think, that would be helpful))
Or you may write me on the telegram, I can help you with C++ too.