Cod sursa(job #803740)
Utilizator | Data | 28 octombrie 2012 10:34:53 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include<fstream>
#include<string.h>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
int nr,i,v[2000001];;
char s1[2000001],s2[2000001],*p,*q;
int main()
{
f>>s1>>s2;
p=s2;
while(q=strstr(p,s1)){
v[++nr]=q-s2;
p = q+1;
}
g<<nr<<"\n";
for(i=1;i<=nr;i++)
g<<v[i]<<" ";
return 0;
}