Pagini recente » Cod sursa (job #2806672) | Cod sursa (job #693650) | Cod sursa (job #1680673) | Cod sursa (job #1680640) | Cod sursa (job #1046572)
program p1;
var i,j,k,l:longint;
s,s1:string;
c:char;
t:array[1..1000] of longint;
f,w:text;
begin
assign(f,'strmatch.in');
reset(f);
assign(w,'strmatch.out');
rewrite(w);
read(f,s);
while not eof(f) do begin
while not eoln(f) do
begin
i:=i+1;
read(f,c);
s1:=s1+c;
if (length(s)=length(s1)) and (s=s1) then begin
j:=j+1;
if j<=1000 then t[j]:=i-length(s1);
delete(s1,1,1);
end
else if length(s)=length(s1)then delete(s1,1,1);;
end;
readln(f);
end;
writeln(w,j);
if j<=1000 then for i:=1 to j do
write(w,t[i],' ')
else for i:=1 to 1000 do
write(w,t[i],' ');
close(w);
end.