Pagini recente » Cod sursa (job #1282162) | Monitorul de evaluare | Cod sursa (job #133846) | Cod sursa (job #1994850) | Cod sursa (job #654518)
Cod sursa(job #654518)
Program strmatch;
var i,nr,rez:longint;
a:array [1..1000] of longint;
b1,b2:array [1..1 shl 15] of char;
s1,s2:ansistring;
ok:boolean;
fi,fo:text;
begin
assign(fi,'strmatch.in');
assign(fo,'strmatch.out');
settextbuf(fi,b1); settextbuf(fo,b2);
reset(fi); rewrite(fo); ok:=true;
readln(fi,s1); read(fi,s2);
while ok do begin
i:=pos(s1,s2); ok:=false;
if i>0 then begin
if nr<1000 then begin inc(nr); a[nr]:=i-1; end;
ok:=true; inc(rez); s2[i]:='#';
end;
end;
writeln(fo,rez);
for i:=1 to nr do write(fo,a[i],' ');
close(fo);
end.