fork download
  1. #include <stdio.h>
  2.  
  3. char* search(char *text, char *pattern)
  4. {
  5. int i, seq;
  6.  
  7. for(seq = 0; text[seq] != '\0'; seq++){
  8. for(i = 0; pattern[i] != '\0'; i++){
  9. if(pattern[i] != text[seq+i]){
  10. seq += i;
  11. break;
  12. }
  13. }
  14. if(pattern[i] == '\0'){
  15. return text+seq;
  16. }
  17. }
  18.  
  19. return NULL;
  20. }
  21.  
  22. int main(int argc, char *argv[])
  23. {
  24. char *r = search("abbbc", "bbc");
  25. puts(r);
  26.  
  27. return 0;
  28. }
  29.  
Runtime error #stdin #stdout 0s 1828KB
stdin
Standard input is empty
stdout
Standard output is empty