Buggy python submission (verdict: Time Limit Exceeded):
def main():
  N, K, C=map(int, input().split())
  S = input()[::-1]
  
  R=[0]*K
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      R[k]=(N-n)
      k+=1
      n += C
    n+=1
  
  S=S[::-1]
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      if n+1 in R:
        print(n+1)
      k+=1
      n += C
    n+=1
  #print(L)
  
if __name__=='__main__':
  main()


Fixed submission:
def main():
  N, K, C=map(int, input().split())
  S = input()

  R=[0]*K
  n, k=N-1, 0
  while k < K:
    if S[n]=='o':
      R[k]=n+1
      k+=1
      n -= C
    n-=1
  R=R[::-1]
  
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      if n+1 == R[k]:
        print(n+1)
      k+=1
      n += C
    n+=1
  #print(L)
  

  
if __name__=='__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  N, K, C=map(int, input().split())
  S = input()
  L,R=[0]*K,[0]*K
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      L[k]=n+1
      k+=1
      n += C
    n+=1
  #print(L)
  S=S[::-1]
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      R[k]=N-n
      k+=1
      n += C
    n+=1

  for l in L:
    if l in R:
      print(l)

if __name__=='__main__':
  main()


Fixed submission:
def main():
  N, K, C=map(int, input().split())
  S = input()

  R=[0]*K
  n, k=N-1, 0
  while k < K:
    if S[n]=='o':
      R[k]=n+1
      k+=1
      n -= C
    n-=1
  R=R[::-1]
  
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      if n+1 == R[k]:
        print(n+1)
      k+=1
      n += C
    n+=1
  #print(L)
  

  
if __name__=='__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n, k, offset=0, 0, 0
  while k < K:
    if n >= offset and S[n]=='o':
      L.append(n+1)
      k+=1
      offset = n + C + 1
    n+=1
  S_Reversed=S[::-1]
  n, k, offset=0, 0, 0
  while k < K:
    if n >= offset and S_Reversed[n]=='o':
      R.append(N - n)
      k+=1
      offset = n + C + 1
    n+=1
  
  
  for l in L:
    if l in R:
      print(l)

if __name__=='__main__':
  N, K, C=map(int, input().split())
  S = input()
  L,R=[],[]
  main()


Fixed submission:
def main():
  N, K, C=map(int, input().split())
  S = input()

  R=[0]*K
  n, k=N-1, 0
  while k < K:
    if S[n]=='o':
      R[k]=n+1
      k+=1
      n -= C
    n-=1
  R=R[::-1]
  
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      if n+1 == R[k]:
        print(n+1)
      k+=1
      n += C
    n+=1
  #print(L)
  

  
if __name__=='__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n, k, offset=0, 0, 0
  while k < K:
    if O[n] >= offset:
      L.append(O[n])
      k+=1
      offset = O[n] + C + 1
    n+=1

  n, k, offset=len(O)-1, -1, N
  while k < K and n>=0:
    if O[n] <= offset:
      R.append(O[n])
      k+=1
      offset = O[n] - C - 1
    n-=1
  
  for l in L:
    if l in R:
      print(l)

if __name__=='__main__':
  N, K, C=map(int, input().split())
  S = input()
  O = [int(x)+1 for x, v in enumerate(list(S)) if v=='o'] 
  L,R=[],[]
  main()


Fixed submission:
def main():
  N, K, C=map(int, input().split())
  S = input()

  R=[0]*K
  n, k=N-1, 0
  while k < K:
    if S[n]=='o':
      R[k]=n+1
      k+=1
      n -= C
    n-=1
  R=R[::-1]
  
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      if n+1 == R[k]:
        print(n+1)
      k+=1
      n += C
    n+=1
  #print(L)
  

  
if __name__=='__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  N, K, C=map(int, input().split())
  S = input()
  Sr = S[::-1]
  L,R=[],[]
  offset=offsetr=0
  for k in range(K):
    idx=S.find('o',offset)
    idxr=Sr.find('o',offsetr)
    L.append(idx+1)
    R.append(N-idxr)
    offset=idx+C+1
    offsetr=idxr+C+1
  for l in L:
    if l in R:
      print(l)

if __name__=='__main__':
  main()


Fixed submission:
def main():
  N, K, C=map(int, input().split())
  S = input()

  R=[0]*K
  n, k=N-1, 0
  while k < K:
    if S[n]=='o':
      R[k]=n+1
      k+=1
      n -= C
    n-=1
  R=R[::-1]
  
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      if n+1 == R[k]:
        print(n+1)
      k+=1
      n += C
    n+=1
  #print(L)
  

  
if __name__=='__main__':
  main()