SHARE
TWEET

Untitled

a guest Oct 16th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <locale.h>
  3. #define N 100
  4. int main()
  5. {
  6.     setlocale(LC_ALL,"Russian");
  7.     char str[N],pod_str[N];
  8.     int n1=10,n2=2;
  9.     gets(str);
  10.     gets(pod_str);
  11.     int count1=1, count2=0;
  12.     for (int i = 0, i < (n1 - n2), i++)
  13.     {
  14.         if (str[i] = pod_str[0])
  15.         {
  16.             for (int j=1; j<n2,j++)
  17.             {
  18.                 if (str[i+j]==pod_str[j])
  19.                 {
  20.                     count1+=1;
  21.                     if (count1 == n2)
  22.                     {
  23.                         count2+=1;
  24.                         count1=1;
  25.                         break;
  26.                     }
  27.                 }
  28.                 else
  29.                 {
  30.                     count1=1;
  31.                     break;
  32.                 }
  33.             }  
  34.         }
  35.     }
  36.     printf("%d",count2);
  37.     system("pause");
  38.     return 0;
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top