Cod sursa(job #551565)

Utilizator vendettaSalajan Razvan vendetta Data 10 martie 2011 21:15:13
Problema Potrivirea sirurilor Scor 0
Compilator fpc Status done
Runda Arhiva educationala Marime 0.73 kb
const f = 'strmatch.in'; g = 'strmacth.out';
var
    s, s1 : array[0..2000000] of char;
    i, x, x2 : longint;
    sol : array[0..1000] of longint;
begin
    assign( input,f ); reset( input );
    assign( output,g ); rewrite( output );
    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;
    i := pos ( s, s1 );
    while i <> 0 do
        begin
        inc ( x );
        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.