Pagini recente » Cod sursa (job #234281) | Cod sursa (job #2977903) | Cod sursa (job #2761584) | Cod sursa (job #3170422) | Cod sursa (job #2865230)
#include <fstream>
#include <string>
#include <vector>
using namespace std;
ifstream cin("strmatch.in");
ofstream cout("strmatch.out");
string a, b;
int depth = 0;
vector<int> match;
int main()
{
cin>>a>>b;
for(int i=0;i<b.length();i++){
if(a[depth] == b[i]){
depth++;
if(depth == a.length()){
match.push_back(i - depth + 1);
i-=depth-1;
depth = 0;
}
}
else depth =0;
}
cout<<match.size()<<endl;
for(auto it:match){
cout<<it<<" ";
}
return 0;
}