Discount in a Shop Submissions | CodeChef

I tried solving this problem and wrote the solution on codechef ide . I was getting the right output.
but as soon as i submitted the solution codechef is giving me wrong output flag.
can some help me to understand whats wrong with my code.
here’s my code:
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[10], max;
int t, i, j, k ,l,flag;
scanf(“%d”, &t);
for(i=0;i<t;i++)
{ l=0;flag=0;
scanf(“%s”, s);
max=s[0];
for(j=1;j<strlen(s);j++)
{
if(max<s[j])
{ k=j; max=s[j];}
if(s[j]==‘0’)
{
l++;
if(l==(strlen(s)-2))
{
flag=1;
break;
}
}

    }
    if(flag)
     printf("%c", s[strlen(s)-1]);
    else
    {
       for(j=0;j<strlen(s);j++)
       {
           if(k==j)
           continue;
           printf("%c",s[j]);
       }
    }
    printf("\n");
}
return 0;

}