Untitled
unknown
plain_text
a year ago
847 B
8
Indexable
#include <stdio.h>
#include <string.h>
#include <ctype.h>
void f(char *tekst, char *podniza){
int ok = 1, br = 0;
for(int i = 0; i < strlen(tekst) - 1; i++){
ok = 1;
int golemina = 0;
for(int j = 0; j < strlen(podniza) - 1; j++){
if(i + j < strlen(tekst) - 1 && tekst[i + j] != podniza[j]){
ok = 0;
}
else if(i + j < strlen(tekst) - 1 && tekst[i + j] == podniza[j]){
golemina++;
}
}
if(ok == 1 && golemina == strlen(podniza) - 1){
br++;
}
}
printf("%d", br);
}
int main() {
char tekst[1000];
fgets(tekst, 100, stdin);
char podniza[1000];
fgets(podniza, 100, stdin);
f(tekst, podniza);
return 0;
}Editor is loading...
Leave a Comment