S,_,*C=`dd`.split l=S.size t=0;C.each{|a|l.times{|i|t+=1 if S[i..-1]=~/^#{a}/}};p t