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

let () =
  let x = read_line () in
  let y = read_line () in
  let m = String.length y in
  let rec doit i x n =
    match quick_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)