Pagini recente » Cod sursa (job #1938839) | Cod sursa (job #2260827) | Cod sursa (job #2851476) | Cod sursa (job #2801362) | Cod sursa (job #209680)
Cod sursa(job #209680)
program pascal;
var f,g:text;
i,j,k,s,m,n,nr:longint;
a,b:array[1..2000001] of char;
c:char;
d:array[1..2000001] of longint;
ok,bun:boolean;
begin
assign(f,'strmatch.in');
assign(g,'strmatch.out');
reset(f);
rewrite(g);
n:=0;
m:=0;
bun:=true;
repeat
begin
read(f,c);
if (ord(c)>47) and (ord(c)<123) then
begin
n:=n+1;
a[n]:=c;
end
else
begin
readln(f);
while not eof(f) do
begin
read(f,c);
m:=m+1;
b[m]:=c;
end;
bun:=false;
end;
end;
until not bun;
nr:=0; s:=0;
for i:=1 to m do
begin
ok:=true;
k:=i;
for j:=1 to n do
if b[k]<>a[j] then
begin
ok:=false;
break;
end
else k:=k+1;
if ok then
begin
s:=s+1;
d[s]:=i-1;
nr:=nr+1;
end;
end;
writeln(g,nr);
if s<=1000 then
for i:=1 to s do write(g,d[i],' ')
else
for i:=1 to 1000 do write(g,d[i],' ');
close(f);
close(g);
end.