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

output = []
t_length = t.length
restart_position = (t_length-1)
while true
  number_position = t.rindex(p, restart_position)
  if number_position == nil
    break
  elsif number_position == 0
    output.push(0)
    break
  else
    output.push(number_position)
    restart_position = number_position-1
  end
end
puts output.reverse