{-# LANGUAGE BangPatterns #-}
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B

between :: Ord a => a -> a -> a -> Bool
between a b c = a <= b && b <= c
{-# INLINE between #-}

nAlpha :: Int
nAlpha = ord 'z' - ord 'a' + 1
nChars :: Integer
nChars = 1 + 2 * toInteger nAlpha + 10

decodeChar :: Char -> Int
decodeChar c
  | between 'a' c 'z' = ord c - ord 'a' + 1
  | between 'A' c 'Z' = ord c - ord 'A' + nAlpha + 1
  | between '0' c '9' = ord c - ord '0' + 2 * nAlpha + 1
  | otherwise = 100
{-# INLINE decodeChar #-}

rollHash :: Integer -> Integer -> Char -> Integer
rollHash len hash ch =
    (toInteger $! decodeChar ch) + (hash * nChars) `mod` nChars ^ len
{-# INLINE rollHash #-}

calcHash :: B.ByteString -> Integer
calcHash !str = B.foldl' (rollHash $! toInteger $! B.length str) 0 str

searchMatch :: B.ByteString -> B.ByteString -> [Int]
searchMatch pat str  = reverse $ thd $ B.foldl' iter (0, initHash, []) $ right `B.snoc` '*'
    where (left, right) = B.splitAt (fromInteger len) str
          patHash = calcHash pat
          initHash = calcHash left
          len = toInteger $! B.length pat
          thd (_, _, !a) = a
          iter (!idx, !hash, !matches) ch =
            (idx + 1, rollHash len hash ch,
              if hash == patHash
                then idx : matches
                else matches)

main :: IO ()
main = do
  str <- B.getLine
  pat <- B.getLine
  mapM_ print $ searchMatch pat str