Cod sursa(job #1281253)
| Utilizator | Data | 2 decembrie 2014 22:50:14 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <fstream>
using namespace std;
char v[2000001],w[2000001];
int main()
{
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
fin>>v;
fin>>w;
char *p;
p=strstr(w,v);
int nr=0,q[1002];
while(p)
{
q[++nr]=p-w;
p=strstr(p+1,v);
if(nr==1000)
p=0;
}
fout<<nr<<endl;
for(int a=1;a<=nr;a++)
fout<<q[a]<<" ";
}
