rendered paste body/*
* franjo stipanovic
* programiranje - vj 8 3
* forbidden to use functions from string.h
*/
#include <stdio.h>
int strustr(char *src, char *seek);
int main()
{
char src[100], seek[100];
scanf("%s", src);
scanf("%s", seek);
printf("%d\n", strustr(src, seek));
getche();
return 0;
}
int strustr(char *src, char *seek)
{
char *p1 = src, *p2 = NULL, *p3 = NULL;
int eq, num = 0;
while (*p1) {
if (*p1 == *seek) {
p3 = p1;
p2 = seek;
eq = 1;
while (*p2) {
if (*p2 != *p3) {
eq = 0;
break;
}
p2++;
p3++;
}
if (eq)
num++;
}
p1++;
}
return num;
}