can anyone plaese help me with this code. why is this no working?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char str[20];
int main()
{
   int t,i;

   scanf("%d",&t);
   for(i=0;i<t;i++)
   {
       int n,j,len;
        int val=0,valu=0,value=0,values=0,valuess=0;
       scanf("%d",&n);
       for(j=0;j<n;j++)
       {

           scanf("%s",&str);
           len=strlen(str);

           if(str[0]=='e' && len==4)
            val++;
           else if(str[0]=='s' && len==6)
           valu++;
           else if(str[0]=='c' && len==8)
            value++;
           else if((str[0]=='e' && len>4) || (str[0]=='m' && len==6))
            values++;
           else if((str[0]=='m' && len>6) || (str[0]=='h' && len==4))
            valuess++;
       }

       if(val>=1 && valu>=1 && value>=1 && values>=1 && valuess>=1)
        printf("yes");
       else
        printf("no");
   }


}

Guessing that you are trying to solve this: CodeChef: Practical coding for everyone
I would say that you need to print “Yes” instead of “yes” and “No” instead of “no”. Otherwise your code seems fine to me. :slight_smile:

2 Likes

@vijju123 Since you edited, now I look dumb. :stuck_out_tongue:

saw your answer and was like why you can’t read the code!! lmao

Well, I just did my job :stuck_out_tongue: . Problem is that I edited, but you didnt XDXDXD

1 Like

I meant editing your answer :stuck_out_tongue:

Done thanks :3