Pagini recente » Cod sursa (job #2075864) | Cod sursa (job #1274989) | Cod sursa (job #2010159) | Cod sursa (job #1462648) | Cod sursa (job #2017469)
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string A, B;
int r[1003];
int main()
{
int i=0, pos=0;
getline(f, A);
getline(f, B);
f.close();
pos=B.find(A, pos);
while(pos!=string::npos)
{
r[i++]=pos;
//pos+=B.find(A[1], pos+1);
pos++;
if(i==1000)break;
pos=B.find(A, pos);
}
g<<i<<'\n';
for(int j=0; j<i; j++)g<<r[j]<<' ';
return 0;
}