Advertisement
sivan_iut

Untitled

Apr 7th, 2020
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. ///HELLO THERE~!
  2. ///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)
  3.  
  4. #include <bits/stdc++.h>
  5.  
  6. #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  7. #define read freopen("blue.txt","r",stdin);
  8. #define write freopen("red.txt","w",stdout);
  9. #define pie 2*acos(0.0);
  10.  
  11. typedef long long ll;
  12.  
  13. using namespace std;
  14.  
  15.  
  16. int main()
  17. {
  18.    // fastio;
  19.  
  20.     ll n;
  21.  
  22.     while(scanf("%lld",&n)!=EOF)
  23.     {
  24.  
  25.         string sadman,mehedi;
  26.         cin>>sadman>>mehedi;
  27.  
  28.  
  29.         if(n>mehedi.size())
  30.         {
  31.             cout<<endl;
  32.             continue;
  33.         }
  34.  
  35.         else if(sadman==mehedi)
  36.         {
  37.             cout<<0<<endl;
  38.             continue;
  39.         }
  40.         else if((sadman.size()==mehedi.size()) && sadman!=mehedi)
  41.         {
  42.             cout<<endl;
  43.             continue;
  44.         }
  45.  
  46.         else
  47.         {
  48.  
  49.             for(ll i=0; i<mehedi.size()-n+1; i++)
  50.             {
  51.  
  52.                 string sivan=mehedi.substr(i,n);
  53.  
  54.  
  55.                 if(sivan==sadman)
  56.                 {
  57.                     cout<<i<<endl;
  58.                 }
  59.             }
  60.         }
  61.     }
  62.  
  63.  
  64.     return 0;
  65.  
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement