Pagini recente » Cod sursa (job #2659408) | Cod sursa (job #379361) | Cod sursa (job #2772865) | Cod sursa (job #1468908) | Cod sursa (job #260442)
Cod sursa(job #260442)
#include <stdio.h>
#include <string.h>
int main(){
char A[2001];
char B[2001];
int poz=0;
char* c,*b;
FILE *fin=fopen("strmatch.in","r");
FILE *fout=fopen("strmatch.out","w");
fgets(A,2000001,fin);
fgets(B,2000001,fout);
b=B;
while(B!=NULL){
c=strstr(b,A);
poz=poz+(int)(c-b);
b=c;
fprintf(fout,"%d",poz);
}
fclose(fin);fclose(fout);
}