Cod sursa(job #260440)
| Utilizator | Data | 17 februarie 2009 06:23:54 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.42 kb |
#include <stdio.h>
#include <string.h>
int main(){
char A[2000001];
char B[2000001];
int poz=0;
char* c;
FILE *fin=fopen("strmatch.in","r");
FILE *fout=fopen("strmatch.out","w");
fgets(A,2000001,fin);
fgets(B,2000001,fout);
while(B!=NULL){
c=strstr(B,A);
poz=poz+(int)(c-B);
B=c;
fprintf(fout,"%d",poz);
}
fclose(fin);fclose(fout);
}