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