def search_position_of_word(t, p)
  output = []
  restart_position = (t.length - 1)
  number_position = t.rindex(p, restart_position)
  if number_position.nil?
    break
  elsif number_position.zero?
    output.push(0)
    break
  else
    output.push(number_position)
    restart_position = number_position - 1
  end
  output.reverse!
end

t = gets.chomp.to_s
p = gets.chomp.to_s

search_position_of_word(t, p)
puts output