Pagini recente » Cod sursa (job #1327362) | Cod sursa (job #2540062) | Cod sursa (job #2689018) | Cod sursa (job #700397) | Cod sursa (job #2617304)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string a,b;
vector <int> res;
int k;
int main()
{
ifstream cin("strmatch.in");
ofstream cout("strmatch.out");
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>a>>b;
int k=0;
size_t poz = b.find(a);
if (poz!=-1) {
res.push_back(poz);
k++;
}
while(1){
poz = b.find(a,poz+1);
if (poz==-1) break;
else {
res.push_back(poz);
k++;
}
}
cout<<k<<"\n";
for (int i=0; i<min(1000,k); i++)
cout<<res[i]<<" ";
return 0;
}