Cod sursa(job #249091)
Utilizator | Data | 27 ianuarie 2009 15:51:45 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include<fstream.h>
#include<string.h>
int main()
{char a[2000001],b[2000001],*p;
int nr=1 ;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
f.get(a,2000001,' ');
f.get(b,2000001,' ');
p=strstr(a,b);
while(p!="\0")
{
p=strstr(p+1,b);
nr++;
}
g<<nr;
return 0;
}