Mai intai trebuie sa te autentifici.
Cod sursa(job #260439)
Utilizator | Data | 17 februarie 2009 06:22:21 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 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){
c=strstr(B,A);
poz=poz+(int)(c-B);
B=c;
fprintf(fout,"%d",poz);
}
fclose(fin);fclose(fout);
}