$S=<>; chop$S; $L=length$S; <>; for$C(<>){ chop$C; $l=length$C; $\+=substr($S,$_,$l)eq$C for 0..$L-$l; } print