Pagini recente » Cod sursa (job #789427) | Cod sursa (job #2463223) | Cod sursa (job #2378039) | Cod sursa (job #1948457) | Cod sursa (job #1327873)
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
char a[2000000], b[2000000], *p;
bool x[2000000];
int main()
{
int i,nr=0;
f.getline(a,2000000);
f.getline(b,2000000);
p=strstr(b,a);
while(p)
{
nr++;
x[p-b]=1;
p=strstr(p+1,a);
}
g<<nr<<'\n';
for(i=0;i<=strlen(b); i++)
if(x[i]) g<<i<<" ";
return 0;
}