Files
leetcode/we/23-1.h
2025-09-15 21:12:04 +08:00

16 lines
283 B
C

#include <string.h>
int countSubstring(char *A,char *B){
int count = 0;
char *p = A;
while(*p != '\0'){
p = strstr(p,B);
if(p != NULL){
count++;
p += strlen(B);
}else{
break;
}
}
return count;
}