Cod sursa(job #1474447)
| Utilizator | Data | 21 august 2015 23:54:45 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <iostream>
#include <cstring>
#include <vector>
#include <fstream>
#define MaxN 2000005
using namespace std;
ofstream fout("strmatch.out");
ifstream fin("strmatch.in");
vector<int>G;
char a[MaxN],b[MaxN],aux[256];
int main()
{
fin.get(a,MaxN);
fin.get();
fin.get(b,MaxN);
char *p=strstr(b,a);
int n=strlen(b);
int ct=0;
while(p && ct<1000)
{
ct++;
G.push_back(n-strlen(p));
p=strstr(p+1,a);
}
fout<<G.size()<<endl;
for(int i=0;i<G.size();i++)
fout<<G[i]<<" ";
}
