Pagini recente » Cod sursa (job #2655566) | Cod sursa (job #932690) | Cod sursa (job #2190198) | Cod sursa (job #1972396) | Cod sursa (job #337456)
Cod sursa(job #337456)
program potri_siruri;
var a,b:string;
i,s,o,j,n,n2,l,p:integer;
x:array[1..100]of integer ;
f1,f2:text;
begin
assign(f1,'strmatch.in'); reset(f1);
assign(f2,'strmatch.out'); rewrite(f2);
readln(f1,a);
read(f1,b);
n:=length(a);
n2:=length(b);
p:=1;
s:=0;
l:=1;
for i:=1 to n2-n do
begin
o:=1;
if a[1]=b[i] then
begin
for j:=2 to n do
if a[j]<>b[i+j-1] then
o:=0;
if o=1 then
begin
s:=s+1;
x[l]:=i-1;
l:=l+1;
end;
{write(f2,s);}
end;
end;
writeln(f2,s);
for p:=1 to l-1 do
write(f2,x[p],' ');
close(f1);
close(f2);
end.