{-# LANGUAGE FlexibleContexts #-}

module Main where

import Debug.Trace
import Data.List
import qualified Data.Set as Set
import qualified Data.Sequence as Seq
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.Word
import Data.Char
import Data.Bits
import Data.Array
-- import Data.Array.Unboxed
-- import Data.Array.IO
import Data.Maybe
-- import qualified Data.Map as M
import qualified Data.IntMap as M
-- import Control.Monad.ST
-- import Data.STRef
import Data.Ord
import Data.Functor
import Control.Applicative
import Control.Monad
import Text.Printf

solver :: String -> String -> [Int]
solver s l = iter 0 [] (take ls l) (drop ls l) where
    ls = length s
    iter _ ac _ [] = reverse ac
    iter i ac sc@(y:ys) (x:xs)
        | s == sc   = iter (i+1) (i:ac) (ys++[x]) xs
        | otherwise = iter (i+1) ac (ys++[x]) xs

main :: IO() 
main = do
    l <- getLine
    s <- getLine
    mapM_ print $ solver s (l++".")

