Cod sursa(job #2331012)
| Utilizator | Data | 29 ianuarie 2019 08:49:58 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 80 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
///memoria de date
char a[2000001],*p;
int i,nr,poz,sters;
int main()
{
///memoria stiva
int potrivire[1001];
char b[2000001];
f>>a>>b;
while(strstr(b+i,a))
{
p=strstr(b+i,a);
poz=p-b;
nr++;
if(nr<=1000) potrivire[nr]=poz;
i=poz+1;
}
g<<nr<<'\n';
int nr1=min(nr,1000);
for(i=1;i<=nr1;i++)
g<<potrivire[i]<<' ';
return 0;
}
