S = gets.chomp T = gets.chomp N = T.size stack = '' ans = 0 S.each_char do |s| stack << s next if stack.size < N if stack[-N..-1] == T stack[-1] = '.' stack << s ans += 1 end end puts ans