Cod sursa(job #2515995)
Utilizator | Data | 29 decembrie 2019 23:14:09 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
#include <iostream>
#include <cstring>
using namespace std;
#define dmax 2000001
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main(){
char a[dmax], b[dmax];
unsigned v[1001], n=0;
fin>>a;
fin.get();
fin>>b;
char *p;
p=b;
do{
p=strstr(p, a);
if (p){
if (n<1000)
v[++n]=p-b;
p=p+1;
}
}while (p);
fout<<k<<endl;
for (int i=1;i<=n;i++)
fout<<v[i]<<" ";
fin.close();
fout.close();
}