mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-04 17:26:32 +08:00
16 lines
283 B
C
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;
|
|
} |