I have to submit this code as a solution. My code runs perfectly for the given test cases, but I am not able to submit as the code fails one of the tests in the solver. Please help if you can. Any help is appreciated.
Gift Article with Digits
Many customers liked the gift articles with digits inscribed on them and they started buying them for gifting for Birthdays and anniversaries. One customer came to purchase a gift for his mom's 25th wedding anniversary and another customer came to purchase a gift for his son's 18th Birthday. They were disappointed to see only single digits inscribed on the gift items.
Seeing the craze for this kind of gift items, Nisha gave a bulk order for gift items with 2 digit numbers inscribed on them. The parcel arrived when she was busy and her 4 year old son started arranging the newly arrived items in the rack for display. But he has placed all items upside down. She needs to change the orientation of the items.
But to her surprise, she found that some 2-digit numbers were valid when read both ways. [Eg. 68 read upside down would be 89 which is also a valid number] Help Nisha in identifying all such 2 digit numbers.
TestCase
Input 1
18
Output 1
YES
Input 2
46
Output 2
NO
Input 3
a4
Output 3
Invalid Input
C code:
#include<stdio.h>
#include<ctype.h>
#include<string.h>
int main()
{
char str[2];
scanf("%s",str);
int flag=0;
if (strlen(str)!=2)
{
flag=2;goto label;
}
else if (str[1]=='0')
{
flag=1;goto label;
}
for(int i=0;i<2;i++)
{
if(isdigit(str[i]))
{
if((str[i]!='0')&&(str[i]!='1')&&(str[i]!='6')&&(str[i]!='8')&&
(str[i]!='9'))
{
flag=1;break;
}
}
else
{flag=2;break;}
}
label:
if (flag==0) printf("YES");
else if (flag==1) printf("NO");
else if (flag==2) printf("Invalid Input");
return 0;
}
The output after evaluation is as follows:

strarray.