Pagini recente » Cod sursa (job #215676) | Cod sursa (job #1399406) | Cod sursa (job #1812267) | Cod sursa (job #2315903) | Cod sursa (job #562381)
Cod sursa(job #562381)
var a,b:array[1..2000000] of char;
c:array[1..1000]of longint;
i,j,n1,n2,nr:longint;
f,g:text;
ok:boolean;
begin
assign(f,'strmatch.in');
assign(g,'strmatch.out');
reset(f);
rewrite(g);
i:=0;
while not eoln(f) do
begin
inc(i);
read(f,a[i]);
end;
n1:=i;
i:=0;
readln(f);
while not eoln(f) do
begin
inc(i);
read(f,b[i]);
end;
n2:=i;
nr:=0;
for i:=1 to n2-n1+1 do
begin
ok:=true;
for j:=1 to n1 do
if b[i+j-1]<>a[j] then begin ok:=false; break; end;
if ok then
begin
inc(nr);
if nr<=1000 then c[nr]:=i-1;
end;
end;
writeln(g,nr);
if nr>1000 then
for i:=1 to 1000 do
write(g,c[i],' ')
else
for i:=1 to nr do
write(g,c[i],' ');
close(g);
end.