rr=Array.new(1003,0) s=gets.chomp t=gets.chomp if t.size==1 then if s.match(t)==nil then puts 0 else puts -1 end else n=s.size m=t.size as=[] 0.upto(n-m){|p1| if s[p1,m]==t then as<<[p1,p1+m-2] end } ans=0 while as.size>0 do ans2=ans+1 pr=as[0][1] while as.size>0 && as[0][0]<=pr do as.shift ans=ans2 end end puts ans end