Pagini recente » Cod sursa (job #693184) | Cod sursa (job #2839437) | Cod sursa (job #2467580) | Cod sursa (job #804119) | Cod sursa (job #1338981)
#include <fstream>
#include <cstring>
using namespace std;
char A[2000010], B[2000010], *p;
int P[2000010], n, m, L, nr, i, S[1010];
ifstream fin ("strmatch.in");
ofstream fout("strmatch.out");
int main()
{
fin >> A;
fin >> B;
p = strstr (B,A);
while(p != NULL)
{
nr++;
if(nr <= 1000)
{
S[nr] = p - B;
}
p = strstr(p+1, A);
}
fout<<nr<<"\n";
if (nr > 1000)
nr = 1000;
for (i=1;i<=nr;i++)
fout<<S[i]<<" ";
return 0;
}