Cod sursa(job #98715)

Utilizator GagosGagos Radu Vasile Gagos Data 10 noiembrie 2007 16:11:55
Problema Abc2 Scor 0
Compilator cpp Status done
Runda Happy Coding 2007 Marime 0.54 kb
#include<fstream.h>
#include<string.h>
#include<stdio.h>
#define I "abc2.in"
#define O "abc2.out"
char *text,alf[50000][20],i,j;
int gas_poz(char *q)
{
char *p;
int k=0;
p=text;
p=strstr(q,text);
if(p!=NULL){
++k;
strcpy(p,p+strlen(q));
while(p!=NULL){
p=strstr(q,p);
if(p!=NuLL)
++k;
}
}
return k;
}
void cit()
{
ifstream f(I);
f>>text;
do{
f>>a[i++];
}while(!f.eof());
f.close();
}
void af()
{
ofstream g(O);
g<<j;
g.close();
}
int main()
{
cit();
for(int l=0;l<i;++l)
j+=gas_poz(a[l]);
af();
return 0;
}