module Main where

import           Control.Monad
import           Debug.Trace
import qualified Data.Vector.Unboxed           as VU
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe
import qualified Data.Text                     as T

tuplify2 (x : y : _) = (x, y)
tuplify2 _           = undefined

getVUIntFromInputLineAtBSC8 :: IO (VU.Vector Int)
getVUIntFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
getVUIntListFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine

readInt = fst . fromJust . BSC8.readInt
readIntTuple = tuplify2 . map readInt . BSC8.words
readIntList = map readInt . BSC8.words

getInt = readInt <$> BSC8.getLine
getIntList = readIntList <$> BSC8.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BSC8.getLine
getIntMatrix = map readIntList . BSC8.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BSC8.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BSC8.getLine
getIntTuples = map readIntTuple . BSC8.lines <$> BSC8.getContents

main :: IO [()]
main = do

    [aN, aK, aC] <- getIntList
    aS           <- getLine
    let maru = 'o'
    let batu = 'x'
    let hiList = foldl
            (\acc x -> if (aS !! (x - 1)) == maru then acc ++ [x] else acc)
            []
            [1 .. length aS]
    let aaa@(aaaBool,aaaList) = getPattern hiList 0 aK aC []

    let
        bbb = foldl
            (\acc x ->
                let ccc@(cccBool, _) = getPattern
                        ((take x hiList) ++ (drop (x + 1) hiList))
                        0
                        aK
                        aC
                        []
                in  if cccBool == False then acc ++ [x] else acc
            )
            []
            aaaList
    mapM print (map (\x -> hiList !! x) bbb)


getPattern :: [Int] -> Int -> Int -> Int -> [Int] -> (Bool, [Int])
getPattern _  _ 0 _ acc = (True, acc)
getPattern [] _ _ _ acc = (False, acc)
getPattern hiList@(hiX : hiXs) n k c acc =
    let next = getNext hiX hiList 0 c
    in getPattern  (drop next hiList) (n + next) (k - 1) c (acc ++ [n])

getNext _ [] n _ = n
getNext hi hiList@(hiX:hiXs) n c = if (hi+c) < hiX then n else getNext hi hiXs (n+1) c
