fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. char animals[][20] = {
  5. "dogs are cool",
  6. "frogs are freaky",
  7. "monkeys are crazy"
  8. };
  9.  
  10. int main() {
  11. char input[10];
  12.  
  13. printf("Enter animal name: ");
  14. scanf("%9s", input);
  15.  
  16. int i;
  17. for(i = 0; i < 3; i++) {
  18. if(strstr(animals[i], input))
  19. printf("%s", animals[i]);
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 1792KB
stdin
frogs
stdout
Enter animal name: frogs are freaky