Cod sursa(job #857031)
| Utilizator | Data | 17 ianuarie 2013 10:08:43 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include <fstream.h>
#include <string.h>
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
#define MAX 2000002
char a[MAX],b[MAX],*p;
long int k[MAX],h,i;
int main()
{
fin.get(a, MAX);
fin.get();
fin.get(b, MAX); p=b;
do
{
p=strstr(p, a);
if (p) {k[h++]=p-b; p++;}
}
while(p);
fout<<h<<'\n';
for(i=0;i<h;i++) fout<<k[i]<<' ';
}
