Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- void funkcija(char * s1, char * s2) {
- int brojac = 0;
- for(int i = 0; i < strlen(s1); i++) {
- if(s1[i] == s2[0]) {
- int ok = 1;
- for(int j = 0; j < strlen(s2); j++) {
- if(i + j >= strlen(s1)) {
- ok = 0;
- break;
- }
- if(s1[i + j] != s2[j]) {
- ok = 0;
- break;
- }
- }
- if(ok == 1) {
- brojac++;
- }
- }
- }
- printf("Podnizata se pojavuva %d\n", brojac);
- }
- int main(int argc, const char * argv[]) {
- char s1[1000];
- char s2[1000];
- fgets(s1, 500, stdin);
- scanf("%s", s2);
- funkcija(s1, s2);
- return 0;
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement