Result says timeout but code is correct
You are given the noises made by different animals that you can hear in the dark, evaluate each noise to determine which animal it belongs to. Lions say 'Grr', Tigers say 'Rawr', Snakes say 'Ssss', and Birds say 'Chirp' Sample Input: Rawr Chirp Ssss Sample Output: Tiger Bird Snake Here is my code ;- #include<stdio.h> #include<string.h> int main() { char p=getchar(); int q=0; while(p!='\n') { char s[100]; scanf("%s",&s); if(q==0){ char str[100]; str[0]=p; strncat(str,s,strlen(s)); strcpy(s,str); } int a=strcmp(s,"Grr"); int b=strcmp(s,"Rawr"); int c=strcmp(s,"Ssss"); int d=strcmp(s,"Chrip"); // printf("%d",c); if(a==0) printf("Lion "); else if(b==0) printf("Tiger "); else if(c==0) printf("Snake "); else if(d==0) printf("Bird "); q=1; p=getchar(); }}