let bm_search x y n m =
  let t = Array.init 256 (fun _ -> m) in
  String.iteri (fun i c -> t.(Char.code c) <- m - 1 - i) y;
  let rec scan i j =
    if x.[i] <> y.[j] then doit (i + max t.(Char.code x.[i]) (m - j))
    else if j = 0 then Some i
    else scan (i - 1) (j - 1)
  and doit i =
    if i = n then None
    else scan i (m - 1)
  in doit (m - 1)

let () =
  let x = read_line () in
  let y = read_line () in
  let m = String.length y in
  let rec doit i x n =
    match bm_search x y n m with
    | None -> ()
    | Some j ->
      begin
        Printf.printf "%d\n" (i + j);
        let s = String.sub x (j + 1) (n - (j + 1)) in
        doit (i + j + 1) s (String.length s)
      end in
  doit 0 x (String.length x)