program cogs624;
var
a:ansistring;
b,t:string;
p:array[1..20] of longint;
i,j,ans,w:longint;
procedure kmp;
var
i,j,m,n:longint;
begin
ans:=0;
m:=length(b);n:=length(a);
p[1]:=0; j:=0;
for i:=2 to length(b) do
begin
while(j>0)and(b[j+1]<>b[i]) do j:=p[j];
if b[j+1]=b[i] then j:=j+1;
p[i]:=j;
end;
j:=0;
for i:=1 to length(a) do
begin
while (j>0)and(b[j+1]<>a[i]) do j:=p[j];
if b[j+1]=a[i] then j:=j+1;
if (j=m)and(a[i+1]=' ')and(a[i-m]=' ') then
begin
if ans=0 then w:=i-m;
inc(ans);
j:=p[j];
end;
end;
end;
begin
assign(input,'stat.in');reset(input);
assign(output,'stat.out');rewrite(output);
readln(b);
readln(a);
a:=a+' ';
for i:=1 to length(b) do
if ord(b[i])<=ord('Z') then b[i]:=char(ord(b[i])+32);
for i:=1 to length(a) do
if (ord(a[i])<=ord('Z'))and(a[i]<>' ') then a[i]:=char(ord(a[i])+32);
kmp;
if ans=0 then write(-1)
else
write(ans,' ',w);
close(input);close(output);
end.