Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <locale.h>
- #define N 100
- int main()
- {
- setlocale(LC_ALL,"Russian");
- char str[N],pod_str[N];
- int n1=10,n2=2;
- gets(str);
- gets(pod_str);
- int count1=1, count2=0;
- for (int i = 0, i < (n1 - n2), i++)
- {
- if (str[i] = pod_str[0])
- {
- for (int j=1; j<n2,j++)
- {
- if (str[i+j]==pod_str[j])
- {
- count1+=1;
- if (count1 == n2)
- {
- count2+=1;
- count1=1;
- break;
- }
- }
- else
- {
- count1=1;
- break;
- }
- }
- }
- }
- printf("%d",count2);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement