Cod sursa(job #286986)
Utilizator | Data | 24 martie 2009 13:22:35 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 14 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include<fstream.h>
#include<string.h>
char a[2000010],*p,b[2000010];
int n=0;
int main()
{
ifstream f("strmatch.in");
ofstream g("strmatch.out");
f.get(b,2000001,'\n'); f.get();
f.get(a,2000001);
p=strstr(a,b);
while(p)
{ n++;
p=strstr(p+1,b);
}
g<<n;
f.close();
g.close();
return 0;
}