
object Main extends App {
  import scala.io.StdIn._
  val sentence = readLine().toList
  val target = readLine().toList
  matchPosition(sentence, target).reverse.foreach{
    println(_)
  }
  def matchPosition(sentence:List[Char], target:List[Char], index:Int = 0, res:List[Int] = Nil):List[Int] = {
    def matchPrefix(sentence:List[Char], target:List[Char]):Boolean = {
      (sentence, target) match{
        case (_, Nil) => true
        case (hs::ts, ht::tt) if hs == ht => matchPrefix(ts, tt)
        case _ => false
      }
    }
    sentence match{
      case Nil => res
      case _::t if matchPrefix(sentence, target) => matchPosition(t, target, index + 1, index :: res)
      case _::t => matchPosition(t, target, index + 1, res)
    }
  }
}

