Cod sursa(job #551590)

Utilizator vendettaSalajan Razvan vendetta Data 10 martie 2011 21:33:12
Problema Potrivirea sirurilor Scor 14
Compilator fpc Status done
Runda Arhiva educationala Marime 0.89 kb
const f = 'strmatch.in'; g = 'strmatch.out';
var
    //s, s1 : string [20000001];
    s, s1 : array[0..2000001] of char;
    i, x, x2 : longint;
    sol : array[0..1001] of longint;
    buf : array[1..1 shl 17] of char;
begin
    assign( input,f ); reset( input );
    assign( output,g ); rewrite( output );
    settextbuf( input,buf);
    {while not eoln( input ) do
        begin
        read( s[i] );
        inc ( i );
        end;
    readln;
    i := 0;
    while not eoln( input ) do
        begin
        read( s1[i] );
        inc ( i );
        end;
    }
    readln(s);
    read(s1);
    i := pos ( s, s1 );
    while i <> 0 do
        begin
        inc ( x );
        write( i-1,' ');
        //sol[ x ] := i-1;
        S1[I] :=' ';
        //delete(s1,i,1);
        i := pos (s, s1);
        end;
    writeln( x );
    //for i := 1 to x do write( sol[i],' ');
end.