Pagini recente » Cod sursa (job #2348256) | Cod sursa (job #2516034) | Cod sursa (job #212373) | Cod sursa (job #2269007) | Cod sursa (job #551670)
Cod sursa(job #551670)
const f = 'strmatch.in'; g = 'strmatch.out';
var
q : string;
//s, s1 : string;// [20000001];
s, s1 : array[0..2000001] of char;
m, 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;
}
while not eoln( input ) do
begin
read( q );
for i := 1 to length( q ) do
begin
inc ( m );
s[m] := q[i];
end;
end;
readln;
m := 0;
while not eoln( input ) do
begin
read( q );
for i := 1 to length( q ) do
begin
inc ( m );
s1[m] := q[i];
end;
end;
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.