S,_,*C=`dd`.split t=0;C.each{|a|i=-1;t+=1while i=S.index(a,i+1)};p t