Cod sursa(job #1938319)
Utilizator | Data | 24 martie 2017 19:18:59 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include<fstream>
#include<cstring>
using namespace std;
char A[2000001],B[2000001];
int n;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
int main()
{f.get(A,2000001);
f.get();
f.get(B,2000001);
while(strstr(B,A))
{n+=strstr(B,A)-B;
n++;
strcpy(B,strstr(B,A)+1);
g<<n-1<<' ';
}
return 0;
}