Cod sursa(job #1914877)
Utilizator | Data | 8 martie 2017 18:48:51 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <bits/stdc++.h>
#define nmax 2000005
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
char a[nmax],b[nmax],*p;
int sol[nmax];
int n;
int main()
{
int i;
fin>>a>>b;
p=strstr(b,a);
while(p)
{
sol[++n]=(p-b);
p++;
p=strstr(p,a);
}
n=min(n,1000);
fout<<n<<"\n";
for(i=1;i<=n;i++)
fout<<sol[i]<<" ";
return 0;
}