Problem:
 Score : 500 points    Problem Statement Takahashi has decided to work on K days of his choice from the N days starting with tomorrow.  You are given an integer C and a string S . Takahashi will choose his workdays as follows:   After working for a day, he will refrain from working on the subsequent C days.  If the i -th character of S is x , he will not work on Day i , where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.   Find all days on which Takahashi is bound to work.      Constraints  1 \leq N \leq 2 \times 10^5  1 \leq K \leq N  0 \leq C \leq N  The length of S is N .  Each character of S is o or x .  Takahashi can choose his workdays so that the conditions in Problem Statement are satisfied.         Input Input is given from Standard Input in the following format:  N  K  C  S       Output Print all days on which Takahashi is bound to work in ascending order, one per line.        Sample Input 1 11 3 2
ooxxxoxxxoo      Sample Output 1 6  Takahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.  There are four possible choices for his workdays: Day 1,6,10 , Day 1,6,11 , Day 2,6,10 , and Day 2,6,11 .  Thus, he is bound to work on Day 6 .       Sample Input 2 5 2 3
ooxoo      Sample Output 2 1
5  There is only one possible choice for his workdays: Day 1,5 .       Sample Input 3 5 1 0
ooooo      Sample Output 3  There may be no days on which he is bound to work.       Sample Input 4 16 4 3
ooxxoxoxxxoxoxxo      Sample Output 4 11
16

Solution (Python):
import bisect
import sys
import itertools
import queue
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    N, K, C = read_values()
    S = input().strip()
    P = []

    c = -1
    for i, s in enumerate(S):
        if s == "o":
            if c == -1:
                c = 0
                L = [i]
            else:
                L.append(i)
        if c == -1:
            continue
        c += 1
        if c > C:
            P.append(L)
            c = -1
    if c != -1:
        P.append(L)

    if len(P) > K:
        return

    t = len(P[-1])
    res = []
    for i in range(len(P) - 1, 0, -1):
        if len(P[i][:t]) == 1:
            res.append(str(P[i][0] + 1))
        
        p = P[i][t - 1]
        t = bisect.bisect_left(P[i - 1], p - C)
    
    if len(P[0][:t]) == 1:
        res.append(str(P[0][0] + 1))

    print("\n".join(res[::-1]))


if __name__ == "__main__":
    main()

Solution (Python):
N, K, C = map(int, input().strip().split())
S = input().strip()

forward_schedule = [-1 if c == 'x' else 0 for c in S]
backward_schedule = [-1 if c == 'x' else 0 for c in S]

i_work = 1
for i in range(N):
  if forward_schedule[i] == -1: continue
  forward_schedule[i] = i_work
  for j in range(1, C+1):
    if i+j < N: forward_schedule[i+j] = -1
  i_work += 1


i_work = K
for i in range(N-1, -1, -1):
  if backward_schedule[i] == -1: continue
  backward_schedule[i] = i_work
  for j in range(1, C+1):
    if i-j >= 0: backward_schedule[i-j] = -1
  i_work -= 1

for i in range(N):
  if forward_schedule[i] == backward_schedule[i] and forward_schedule[i] > 0:
    print(i+1)

Solution (Python):
N, K, C = map(int, input().split())
S = input()

s_len = len(S)
from_begin = set()
from_end = set()
i = 0
while(i < s_len):
    if S[i] == "o":
        from_begin.add(i+1)
        i += C
    i += 1

i = s_len - 1

while(i > -1):
    if S[i] == "o":
        from_end.add(i+1)
        i -= C
    i -= 1



if len(from_begin) != K or len(from_end) != K:
    exit()
else:
    ans_array = list(from_end & from_begin)
    ans_array.sort()
    print("\n".join(map(str, ans_array)))

Solution (Python):


def main():
    n, k, c = map(int, input().split())
    s = input()

    left = getleft(s, n, c)
    right = list(reversed(getleft(s[::-1], n, c)))

    if n == 1:
        print(1)
        return

    for i in range(n):
        if i == 0:
            canrest = (right[i + 1][0] >= k)
        elif i == n - 1:
            canrest = (left[i - 1][0] >= k)
        else:
            if left[i - 1][0] + right[i + 1][0] >= k + 1:
                canrest = True
            elif (left[i - 1][0] + right[i + 1][0] >= k) and (left[i - 1][1] + right[i + 1][1] >= c - 1):
                canrest = True
            else:
                canrest = False
        if not canrest:
            print(i + 1)

def getleft(s, n, c):
    left = [None for i in range(n)]
    x = 0
    d = 10 ** 9
    for i in range(n):
        if s[i] == "o":
            if d >= c:
                x += 1
                d = 0
            else:
                d += 1
        else:
            d += 1
        left[i] = (x, d)
    return left

if __name__ == "__main__":
    main()

Solution (Python):
N, K, C = map(int, input().split())
S = input()

if N==1:
  print(1)
  exit()

Af = [0]*N
Rf = [0]*N
d = 0
f = 0
for i, s in enumerate(S):
    f-=1
    if s=='o' and f<0:
        d+=1
        f=C
    Af[i]=d
    Rf[i]=C-f

Ab = [0]*N
Rb = [0]*N
d = 0
f = 0
for i, s in enumerate(S[::-1]):
    f-=1
    if s=='o' and f<0:
        d+=1
        f=C
    Ab[N-i-1]=d
    Rb[N-i-1]=C-f

if Ab[1]<K:
    print(1)

for i in range(1, N-1):
    if Af[i-1]+Ab[i+1]>K: continue
    if Af[i-1]+Ab[i+1]==K and Rf[i-1]+Rb[i+1]+1>=C: continue
    print(i+1)

if Af[-2]<K:
    print(N)

Solution (Python):
n,k,c = (int(num) for num in input().split())
s = input()
earliest = [0] * k
idx = 0
for i in range(n):
    if s[i] == "o" and (idx == 0 or i - earliest[idx-1] > c):
        earliest[idx] = i
        idx += 1
    if idx >= k:
        break
        
latest = [0] * k
idx = k - 1
for i in range(n-1,0,-1):
    if s[i] == "o" and (idx == k-1 or latest[idx+1] - i > c):
        latest[idx] = i
        idx -= 1
    if idx < 0:
        break
        


        
for i in range(k):
    if earliest[i] == latest[i]:
        print(earliest[i] + 1)

Solution (Python):
N, K, C = map(int, input().split())
S = list(input())


dp1 = [0] * (N + 1)  
dp1[0] = 0
for i, s in enumerate(S, start=1):
    if s == 'x':
        dp1[i] = dp1[i - 1]
        continue
    b = max(0, i - C - 1)
    dp1[i] = dp1[b] + 1


dp2 = [0] * (N + 1)  
for i in reversed(range(N)):
    s = S[i]
    if s == 'x':
        dp2[i] = dp2[i + 1]
        continue
    b = min(N, i + C + 1)
    dp2[i] = dp2[b] + 1


ans = []

for i in range(1, N + 1):
    if dp1[i - 1] + dp2[i] < K:
        ans.append(i)

print(*ans, sep="\n")

Solution (Python):
def solve(n, k, c, s):
    ls = set()
    lp = -c - 1
    lc = 0
    for i, w in enumerate(s):
        if w == 'o' and i > lp + c:
            ls.add(i)
            lp = i
            lc += 1

    if lc > k:
        return []

    rp = n + c
    ans = []
    for i in range(n - 1, -1, -1):
        w = s[i]
        if w == 'o' and i < rp - c:
            if i in ls:
                ans.append(i + 1)
            rp = i

    ans.reverse()
    return ans


n, k, c = map(int, input().split())
s = input()
ans = solve(n, k, c, s)
print('\n'.join(map(str, ans)))

Solution (Python):


n, k, c = [0] * 3
s = ""

def format_input(filename = None):
	global n, k, c
	global s
	if filename == None:
		n, k, c = list(map(int, input().split()))
		s = str(input())

	elif filename == '__random__':
		from random import randint as rng
		from random import choices
		n = rng(1, 2 * 10**5)
		k = rng(1, n)
		c = rng(0, n)
		s = ''.join(choices('ox', k = n))
		print(n, k, c)
		print(s)

def get_answer():
	left = []
	pointer = 0
	while pointer < n and len(left) < k:
		if s[pointer] == 'o':
			left.append(pointer + 1)
			pointer += c + 1
		else:
			pointer += 1

	right = []
	pointer = n - 1
	while pointer >= 0 and len(right) < k:
		if s[pointer] == 'o':
			right.append(pointer + 1)
			pointer -= c + 1
		else:
			pointer -= 1

	fixed = []
	if len(left) == k and len(right) == k:
		for i in range(k):
			if left[i] == right[-(i+1)]:
				fixed.append(left[i])

	for i in range(len(fixed)):
		print(fixed[i])

if __name__ == '__main__':
	format_input()

	get_answer()

Solution (Python):

N,K,C=map(int,input().split())
S=input()
X=[]
for i in range(N):
    if S[i]=="o":
        X.append(i+1)
M=len(X)

if M==1:
    
    print(X[0])
    exit()


L=[-1 for i in range(M)]
R=[-1 for i in range(M)]
j=1
for i in range(M-1):
    while(j<M):
        if X[j]-X[i]>=C+1:
            R[i]=j
            break
        else:
            j+=1
j=M-2
for i in range(M-1,0,-1):
    while(j>=0):
        if X[i]-X[j]>=C+1:
            L[i]=j
            break
        else:
            j-=1
LD=[-1 for i in range(M)]
RD=[-1 for i in range(M)]
def Ldfs(i):
    if LD[i]!=-1:
        return LD[i]
    if L[i]==-1:
        LD[i]=1
        return 1
    else:
        LD[i]=Ldfs(L[i])+1
        return Ldfs(L[i])+1
def Rdfs(i):
    if RD[i]!=-1:
        return RD[i]
    if R[i]==-1:
        RD[i]=1
        return 1
    else:
        RD[i]=Rdfs(R[i])+1
        return Rdfs(R[i])+1
for i in range(M):
    Ldfs(i)
    Rdfs(M-1-i)
Y=[0 for i in range(M)]
Y[0]=RD[1]
Y[-1]=LD[-2]
for i in range(1,M-1):
    Y[i]=LD[i-1]+RD[i+1]
for i in range(M):
    if Y[i]<K:
        print(X[i])

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,c,k = LI()
    s = input()
    k += 1
    dpl = [0]*n
    if s[0] == "o":
        dpl[0] = 1
    else:
        dpl[0] = 0
    for i in range(1,n):
        dpl[i] = dpl[i-1]
        if s[i] == "o":
            dpl[i] = max(dpl[i-k]+1,dpl[i])
    dpr = [0]*n
    if s[-1] == "o":
        dpr[-1] = 1
    else:
        dpr[-1] = 0
    for i in range(n-1)[::-1]:
        dpr[i] = dpr[i+1]
        if s[i] == "o":
            dpr[i] = max(dpr[(i+k)%n]+1, dpr[i])
    dpl = [0]+dpl
    dpr += [0]
    ans = []
    for i in range(n):
        if dpl[i]+dpr[i+1] < c:
            print(i+1)
    return


if __name__ == "__main__":
    solve()

Solution (Python):
N, K, D = map(int, input().split())
S = [True if x == 'o' else False for x in input()]

l_lst, r_lst = [], []
i = 1
for _ in range(K):
    while not S[i - 1]:
        i += 1
    l_lst.append(i)
    i += D + 1

i = N
for _ in range(K):
    while not S[i - 1]:
        i -= 1
    r_lst.append(i)
    i -= D + 1
r_lst.reverse()

for i in range(K):
    ans = l_lst[i]
    if ans == r_lst[i]:
        print(ans)

Solution (Python):
n,k,c = map(int,input().split())
s = input()
frt = [0]*n
bck = [0]*n
cnt = 0
cntb = 0
prv = 0
prvb = 0
st = set()
stb = set()
for i in range(n):
  if cnt == 0 and s[i] == "o":
    cnt += 1
    frt[i] = 1
    prv = i
    st.add(i)
  elif i-prv > c and s[i] == "o":
    cnt += 1
    frt[i] = cnt
    prv = i
    st.add(i)
for i in range(n)[::-1]:
  if cntb == 0 and s[i] == "o":
    cntb += 1
    bck[i] = 1
    prvb = i
    stb.add(i)
  elif prvb-i > c and s[i] == "o":
    cntb += 1
    bck[i] = cntb
    prvb = i
    stb.add(i)
ans = []
for i in range(n):
  if i not in st or i not in stb:
    continue
  if frt[i]-1 + bck[i]-1 >= k:
    continue
  print(i+1)

Solution (Python):
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


N, K, C = list(map(int, sys.stdin.buffer.readline().split()))
S = sys.stdin.buffer.readline().decode().rstrip()


dp1 = [0] * (N + 1)
cnt = 0
rem = -1
for i, c in enumerate(S):
    if rem < 0 and c == 'o':
        cnt += 1
        rem = C
    dp1[i + 1] = cnt
    rem -= 1


dp2 = [0] * (N + 1)
cnt = 0
rem = -1
for i, c in reversed(list(enumerate(S))):
    if rem < 0 and c == 'o':
        cnt += 1
        rem = C
    dp2[i] = cnt
    rem -= 1







for i, (c, cnt1, cnt2) in enumerate(zip(S, dp1, dp2[1:]), start=1):
    
    if cnt1 + cnt2 < K:
        print(i)

Solution (Python):
n, k, c = map(int, input().split())
s = input()
dp = [0]*(n+1)
nxt = [-1]*n
now = -1
flag = [-1]*n
pre = -c-2
cnt = 0
for i in range(n):
    if s[i] == 'o':
        if now != -1: nxt[now] = i
        now = i
        if pre+c<i and cnt<k:
            pre = i
            flag[i] = cnt
            cnt+=1
dp = [0]*(n+1)
for i in range(n)[::-1]:
    if s[i] == 'x':
        dp[i] = dp[i+1]
        continue
    dp[i] = 1 if i+c+1 >= n else dp[i+c+1]+1
for i in range(n):
    if flag[i] == -1:
        continue
    if flag[i]+dp[nxt[i]]<k:
        print(i+1)

Solution (Python):
N, K, C = map(int, input().split())
S = input()



start = S.index("o")
dp1 = [-1] * N
dp1[start] = 1
i = start
while dp1[i] < K:
    tmp = dp1[i]

    i += C
    while i < N:
        i += 1
        if S[i] == "o":
            dp1[i] = tmp + 1
            break


T = S[::-1]
start = T.index("o")
dp2 = [-1] * N
dp2[start] = K
i = start
while dp2[i] > 1:
    tmp = dp2[i]
    i += C
    while i < N:
        i += 1
        if T[i] == "o":
            dp2[i] = tmp - 1
            break
dp2.reverse()

ans = []
for i in range(N):
    if dp1[i] == -1 or dp2[i] == -1:
        continue
    if dp1[i] == dp2[i]:
        ans.append(i + 1)

if ans:
    print(*ans, sep="\n")

Solution (Python):
import sys
input = sys.stdin.readline


n,k,c = map(int,input().split())
s = list(input())

if c == 0:
    res = []
    for i in range(n):
        if s[i] == "o":
            res.append(i+1)
    if len(res) <= k:
        for e in res:
            print(e)
    exit()


back = [0]*(n+1)
fro = [0]*(n+1)

for i in range(n-1,-1,-1):
    if i >= n-c:
        if back[i+1] == 1:
            back[i] = 1
        elif s[i] == "o":
            back[i] = 1
        else:
            back[i] = 0
    else:
        if s[i] == "o":
            back[i] = max(back[i+c+1]+1,back[i+1])
        else:
            back[i] = back[i+1]

for i in range(n):
    if i <= c:
        if fro[i-1] == 1 or s[i] == "o":
            fro[i] = 1
        else:
            fro[i] = 0

    else:
        if s[i] == "o":
            fro[i] = max(fro[i-c-1]+1,fro[i-1])
        else:
            fro[i] = fro[i-1]


for i in range(n):
    if i == 0:
        if n == 1:
            print(1)
        else:
            if back[1] < k:
                print(1)
        continue

    if back[i+1] + fro[i-1] < k:
        print(i+1)

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline

    N, K, C = map(int, input().split())
    S = input().rstrip('\n')

    cnt = 0
    c = 0
    rec = {}
    prev = 0
    for i, s in enumerate(S):
        if c:
            c -= 1
            if s == 'o':
                rec[prev].append(i)
            continue
        if s == 'o':
            c = C
            rec[i] = []
            prev = i
            cnt += 1
    if cnt > K:
        exit()
    X = list(rec.keys())
    X.sort()
    ans = []
    prev = 10**9
    for i in range(K-1, -1, -1):
        x = X[i]
        prev_new = x
        for y in rec[x]:
            if y+C < prev:
                prev_new = y
            else:
                break
        if prev_new == x:
            ans.append(x+1)
        prev = prev_new
    for a in reversed(ans):
        print(a)


if __name__ == '__main__':
    main()

Solution (Python):
N,K,C = map(int,input().split())
S = list(input())
L = [(0,-C) for i in range(N+1)]
R = [(0,N+C+1) for i in range(N+1)]
for i in range(N):
	l = L[i]
	s = S[i]
	if s == "o" and l[1] + C < i+1:
		L[i+1] = (l[0]+1, i+1)
	else:
		L[i+1] = L[i]

	r = R[N-i]
	s = S[N-1-i]
	if s == "o" and N-i + C < r[1]:
		R[N-i-1] = (r[0]+1, N-i)
	else:
		R[N-i-1] = R[N-i]

R = [(0,0)] + R

for n in range(N):
	d = n+1
	if d == 1:
		if R[2][0] < K:
			print(d)
		continue
	if d == N:
		if L[N-1][0] < K:
			print(d)
		continue
	l = L[d-1]
	r = R[d+1]
	w_l, w_r=0, 0
	if l[1] + C > N:
		w_l = l[0]
	else:
		w_l = l[0] + R[max(d+1, l[1]+C)][0]
	if r[1] - C <= 0:
		w_r = r[0]
	else:
		w_r = r[0] + L[min(d-1, r[1]-C)][0]
	if w_l < K and w_r < K:
		print(d)

Solution (Python):
n, k, c = map(int, input().split())
s = input()

if c == 0:
    o = s.count('o')
    if o == k:
        for i in range(n):
            if s[i] == 'o':
                print(i + 1)
    exit()

pr = [0] * n
for i in range(n):
    if s[i] == 'o':
        pr[i] = 1
for i in range(n):
    if i >= 1:
        pr[i] = max(pr[i - 1], pr[i])
    if s[i] == 'o' and i >= c + 1:
        pr[i] = max(pr[i], pr[i - (c + 1)] + 1)
sf = [0] * n
for i in range(n):
    if s[i] == 'o':
        sf[i] = 1
for i in range(n - 1, -1, -1):
    if i + 1 < n:
        sf[i] = max(sf[i + 1], sf[i])
    if s[i] == 'o' and i + (c + 1) < n:
        sf[i] = max(sf[i], sf[i + (c + 1)] + 1)

b = [0] * (n + 1)
for i in range(n + c + 1):
    j = i - (c + 1)
    u = sf[i] if 0 <= i < n else 0
    v = pr[j] if 0 <= j < n else 0
    if u + v < k:
        b[min(max(0, i), n)] -= 1
        b[max(0, min(n, j + 1))] += 1

cb = 0
for i in range(n):
    cb += b[i]
    if cb >= c and s[i] == 'o':
        print(i + 1)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k, c = map(int, readline().split())
s = input()
cnt_1 = 0
cnt_2 = n - 1
cnt = [0, 0]
ans = [0] * n
for i in range(n):
    if s[cnt_1] == 'o':
        ans[cnt_1] += 1
        cnt_1 += c
        cnt[0] += 1
    cnt_1 += 1
    if cnt_1 > n - 1:
        break
for i in range(n):
    if s[cnt_2] == 'o':
        ans[cnt_2] += 1
        cnt_2 -= c
        cnt[1] += 1
    cnt_2 -= 1
    if cnt_2 < 0:
        break
if max(cnt) > k:
    print()
else:
    for i in range(n):
        if ans[i] == 2:
            print(i + 1)

Solution (Python):
def solve(n, k, c, s):
    
    g_f = [0] * n
    last_worked = - c - 1
    cnt = 0
    for i in range(n):
        if last_worked + c + 1 <= i and s[i] == "o":
            cnt += 1
            g_f[i] = cnt
            last_worked = i
        if cnt == k:
            break
    

    
    g_l = [0] * n
    last_worked = n + c
    cnt = k
    for i in range(n - 1, -1, -1):
        if i + c + 1 <= last_worked and s[i] == "o":
            g_l[i] = cnt
            cnt -= 1
            last_worked = i
        if cnt == 0:
            break
    

    res = []
    for i in range(n):
        if 0 < g_f[i] == g_l[i]:
            res.append(i + 1)
    return res


def main():
    n, k, c = map(int, input().split())
    s = input()
    res = solve(n, k, c, s)
    for r in res:
        print(r)


def test():
    assert solve(11, 3, 2, "ooxxxoxxxoo") == [6]
    assert solve(5, 2, 3, "ooxoo") == [1, 5]
    assert solve(5, 1, 0, "ooooo") == []
    assert solve(16, 4, 3, "ooxxoxoxxxoxoxxo") == [11, 16]


if __name__ == "__main__":
    test()
    main()

Solution (Python):
n, k, c = map(int, input().split())
s = input()

max_ = 0
dp = [0] * (n + 1)
cnt = {0: 0}
for i in range(n)[::-1]:
    max_ = max(dp[min(i + c + 1, n)] + 1, max_)
    if s[i] == "o":
        dp[i] = max_
        if dp[i] not in cnt:
            cnt[dp[i]] = 1
        else:
            cnt[dp[i]] += 1

if max_ > k:
    exit()
  
i = 0
ans = []
while True:
    if i >= n:
        break
        
    if s[i] == "x":
        i += 1
        continue
        
    if k == dp[i]:
        if cnt[k] == 1:
            ans.append(i)
        for j in range(c + 1):
            cnt[dp[min(i + j, n)]] -= 1
        i = i + c + 1
        k -= 1
        continue
    else:
        cnt[dp[i]] -= 1
        i += 1
for i in ans:
    print(i + 1)

Solution (Python):
N,K,C = map(int,input().split())
S = input()
def solve():
    if C==0:
        a = [i+1 for i,c in enumerate(S) if c=='o']
        if len(a)==K:
            print(*a, sep='\n')
        else:
            print()
        exit()
    l = []
    y = 0
    for i,c in enumerate(S):
        if y:
            y -= 1
            continue
        if c=='o':
            y = C
            l.append(i+1)
            if len(l) == K:
                break
    r = []
    y = 0
    for i,c in enumerate(S[::-1]):
        if y:
            y -= 1
            continue
        if c=='o':
            y = C
            r.append(N-i)
            if len(r) == K:
                break

    ans = set(l) & set(r)
    print(*sorted(ans), sep='\n')
solve()

Solution (Python):
import sys
readline = sys.stdin.readline

N, K, C = map(int, readline().split())
S = readline().rstrip()

O = 'o'
X = 'x'


l2r = [None] * N

offset = 0
count = 0
while True:
    i = offset
    while i < N:
        if S[i] == O:
            offset = i + C + 1
            l2r[i] = 1
            count += 1
            break
        i += 1

    if i >= N:
        break

if count > K:
    exit(0)

r2l = [None] * N
count = 0
offset = N - 1
while True:
    i = offset
    while i > -1:
        if S[i] == O:
            offset = i - C - 1
            r2l[i] = 1
            count += 1
            break
        i -= 1
    if i <= -1:
        break


for i in range(N):
    if l2r[i] == 1 and r2l[i] == 1:
        print(i + 1)

Solution (Python):
def examA():
    X, Y, Z = LI()
    X, Y = Y,X
    X,Z = Z, X
    print(X,Y,Z)
    return

def examB():
    N, M = LI()
    A = LI()
    need = (sum(A)-1)//(4*M) + 1
    ans = 0
    
    for a in A:
        if a>=need:
            ans += 1
    if ans>=M:
        print("Yes")
    else:
        print("No")
    return

def examC():
    N, K = LI()
    ans = N%K
    if K-ans<ans:
        ans = K-ans
    print(ans)
    return

def examD():
    def bfs(n):
        
        W = [""] * n
        
        que = deque()
        for i in range(1,10):
            que.append(str(i))
            W[i-1] = str(i)
        i = 9
        while(i<n):
            now = que.popleft()
            end = now[-1]
            for j in [-1,0,1]:
                ne = int(end)+j
                if 0<=ne<=9:
                    W[i] = now + str(ne)
                    que.append(W[i])
                    i += 1
                    if i==n:
                        break
        return W
    K = I()
    if K<=12:
        ans = K
        print(ans)
        return
    ans = bfs(K)[-1]
    print(ans)
    return

def examE():
    N, K, C = LI()
    S = SI()
    L = set()
    R = set()
    prev = -inf
    for i,s in enumerate(S):
        if s=="x":
            continue
        if prev+C>=i:
            continue
        L.add(i)
        prev = i
    if len(L)>K:
        print()
        return
    prev = inf
    for i in range(N)[::-1]:
        s = S[i]
        if s=="x":
            continue
        if prev-C<=i:
            continue
        R.add(i)
        prev = i
    
    ans = []
    for i in L:
        if i in R:
            ans.append(i+1)
    if not ans:
        print()
        return
    ans.sort()
    for v in ans:
        print(v)
    return

def examF():
    N = I()

    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examE()

"""

"""

Solution (Python):
import sys
input = sys.stdin.readline

N,K,C=map(int,input().split())
S="x"+input().strip()+"x"

N=len(S)
SUML=[0]*N
SUMR=[0]*N

NEXT=0
for i in range(N):
    if i>=NEXT and S[i]=="o":
        SUML[i]=SUML[i-1]+1
        NEXT=i+C+1
    else:
        SUML[i]=SUML[i-1]

S2=S[::-1]

NEXT=0
for i in range(N):
    if i>=NEXT and S2[i]=="o":
        SUMR[i]=SUMR[i-1]+1
        NEXT=i+C+1
    else:
        SUMR[i]=SUMR[i-1]

SUMR=SUMR[::-1]

ANS=[]
for i in range(1,N-1):
    if S[i]=="o" and SUML[i-1]+SUMR[i+1]==K-1:
        ANS.append(i)

print(*sorted(ANS))

Solution (Python):
N, K, C = map(int, input().split())
S = [1 if a == "o" else 0 for a in input()]

c = 0
X = [0] * N
Y = [0] * N

i = 0
while i < N:
    if S[i]:
        c += 1
        X[i] = 1
        i += C + 1
    else:
        i += 1

if c > K:
    exit()

i = N - 1
while i >= 0:
    if S[i]:
        Y[i] = 1
        i -= C + 1
    else:
        i -= 1

for i in range(N):
    if X[i] and Y[i]:
        print(i + 1)

Solution (Python):
N, K, C = map(int, input().split())
S = [1 if a == "o" else 0 for a in input()]

c = 0
X = [0] * N
Y = [0] * N

i = 0
while i < N:
    if S[i]:
        c += 1
        X[i] = 1
        i += C + 1
    else:
        i += 1

if c > K:
    exit()

i = N - 1
while i >= 0:
    if S[i]:
        Y[i] = 1
        i -= C + 1
    else:
        i -= 1

for i in range(N):
    if X[i] and Y[i]:
        print(i + 1)

Solution (Python):

N,K,C = map(int,input().split())

S = input()

l = [0]

last = float("-inf")
for i in range(N):

    if i > last+C and S[i] == "o":
        l.append(l[-1]+1)
        last = i
    else:
        l.append(l[-1])

l.append(l[-1])

r = [0]
last = float("-inf")
for i in range(N):

    if i > last+C and S[N-1-i] == "o":
        r.append(r[-1]+1)
        last = i
    else:
        r.append(r[-1])

r.append(r[-1])
r.reverse()

for i in range(1,N+1):

    if S[i-1] == "o" and l[i-1] + r[i+1] < K:
        print (i)

Solution (Python):
n,k,c=map(int,input().split())
s=[i for i in input()]
a=[0 for i in range(n)]
b=[0 for i in range(n)]
i=0
while i<n:
    if s[i]=="o":
        a[i]=1
        i+=c
    i+=1
s.reverse()
i=0
while i<n:
    if s[i]=="o":
        b[i]=1
        i+=c
    i+=1
b.reverse()
if sum(a)>k:
    quit()
for i in range(n):
    if a[i] and b[i]:
        print(i+1)

Solution (Python):
n, k, c = map(int, input().split())
s = input()

INF = 1 << 20
ldp = [-INF] * n
rdp = [-INF] * n

past_max = 0

for i in range(n):
    if i-c-1>= 0: past_max = max(past_max, ldp[i-c-1])
    if s[i] == 'x': continue
    ldp[i] = past_max + 1

future_max = 0
for i in range(n-1, -1, -1):
    if i+c+1 < n: future_max = max(future_max, rdp[i+c+1])
    if s[i] == 'x': continue
    rdp[i] = future_max + 1

dist = [[] for i in range(k + 10)]

for i in range(n):
    if s[i] == 'x':continue
    if ldp[i] + rdp[i] - 1 != k:continue
    dist[ldp[i]].append(i)

for i in range(k+10):
    if len(dist[i]) == 1:
        print(dist[i][0] + 1)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n, k, c = LI()
    s = S()
    ans = [inf]
    tmp = -inf
    for i in range(n - 1, -1, -1):
        if ans[-1] - c > i and s[i] == "o":
            ans.append(i)
            if len(ans) > k:
                break
    ans.remove(inf)
    ans.sort()
    if len(ans) != k:
        return
    t_ans = [0] * (n + 1)
    for i in range(n):
        if s[i] == "o" and tmp + c + 1 <= i:
            tmp = i
            t_ans[i+1] = t_ans[i] + 1
        else:
            t_ans[i+1] = t_ans[i]
    tt = []
    tmp = 0
    for tmp, ai in enumerate(ans):
        if ai == 0:
            tt.append(str(ai + 1))
            continue
        if t_ans[ai] == tmp:
            tt.append(str(ai + 1))
    print("\n".join(tt))




    return



if __name__ == '__main__':
    solve()

Solution (Python):
import sys
input = sys.stdin.readline

N, K, C = map(int, input().split())
S = list(input().rstrip())

A = [0]
go = C
for s in S:
    if go >= C:
        if s == "o":
            A.append(A[-1]+1)
            go = 0
        else:
            A.append(A[-1])
    else:
        go += 1
        A.append(A[-1])

B = [0]*(N+1)
go = C
for i in reversed(range(N)):
    s = S[i]
    if go >= C:
        if s == "o":
            B[i] = B[i+1]+1
            go = 0
        else:
            B[i] = B[i+1]
    else:
        go += 1
        B[i] = B[i+1]

ans = []
for n in range(N):
    if S[n] == "o" and A[n] + B[n+1] < K:
        ans.append(str(n+1))

print("\n".join(ans))

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K, C = map(int, readline().split())
S = read().rstrip().decode()


def compute(S):
    dp = [0] * N
    for i, x in enumerate(S):
        if i <= C:
            dp[i] = 1
        else:
            if x == 'x':
                dp[i] = dp[i - 1]
            else:
                dp[i] = dp[i - C - 1] + 1
        if dp[i - 1] > dp[i]:
            dp[i] = dp[i - 1]
    return dp


dp1 = compute(S)
dp2 = compute(S[::-1])[::-1]


def get_answers():
    for i in range(N):
        before = dp1[i - 1] if i else 0
        after = dp2[i + 1] if i < N - 1 else 0
        if before + after < K:
            yield i + 1


for x in get_answers():
    print(x)

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

n, k, c = na()
s = ns()

wp = []
for i in range(n):
    if s[i] == 'o':
        last = -99999 if len(wp) == 0 else wp[-1] + c
        if last < i:
            wp.append(i)

wf = []
for i in range(n-1, -1, -1):
    if s[i] == 'o':
        last = 99999999 if len(wf) == 0 else wf[-1] - c
        if last > i:
            wf.append(i)
wf = wf[::-1]

if len(wp) != k:
    sys.exit(0)

swp = set(wp)
for d in wf:
    if d in swp:
        print(d+1)