SHARE
TWEET

Untitled

a guest Oct 30th, 2018 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. string a,b;
  5. vector<int>v;
  6. int main()
  7. {
  8.     cin>>b>>a;
  9.     int q=0;
  10.     int g=0;
  11.     for(int i=0;i<b.size();i++)
  12.     {
  13.         if(i+a.size()>b.size())break;
  14.             if(b[i]==a[0])for(int j=0;j<a.size();j++)
  15.             {
  16.                 if(b[i+j]!=a[j])break;
  17.                 if(j==a.size()-1)v.push_back(i);
  18.                 }
  19.     }
  20.  
  21.    for(int i=0;i<v.size();i++)
  22.    {
  23.        if(i!=v.size()-1)
  24.        cout<<v[i]<<' ';else cout<<v[i];
  25.    }
  26.  
  27.     return 0;
  28. }
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