Problem: 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.

Submission attempts (in order):
N, K, C = map(int, input().split())
S = input()

work_date = []
count = 0


pw = 0

for d in range(K):

    w = S[pw:].index('o') + pw
    work_date.append(w)

    
    pw = w + C + 1
    

work_date_l = []

Sr = list(reversed(S))
pw = 0

for d in range(K):

    w = Sr[pw:].index('o') + pw
    work_date_l.append((N-1)-w)

    
    pw = w + C + 1

work_date_l.sort()
    
count = 0
for i in range(K):
    if work_date[i] == work_date_l[i]:
        count += 1
        
print(count)

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

Sr = "".join(list(reversed(S)))

wd = []
wdl = []

pw = 0
pwl = 0

for d in range(K):

    
    while True:
        if S[pw] == ('o'):
            wd.append(pw)
            break
        pw += 1
    pw += C + 1
    
    
    while True:
        if Sr[pwl] == ('o'):
            wdl.append(pwl)
            break
        pwl += 1
    pwl += C + 1

wdl.sort()
    
for i in range(K):
    if wd[i] == wdl[i]:
        print(wd[i] + 1)

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

Sr = "".join(list(reversed(S)))

wd = []
wdl = []

pw = 0
pwl = 0

for d in range(K):

    
    while True:
        if S[pw] == ('o'):
            wd.append(pw)
            break
        pw += 1
    pw += C + 1
    
    
    while True:
        if Sr[pwl] == ('o'):
            wdl.append(pwl)
            break
        pwl += 1
    pwl += C + 1

en = time.time()

wdl.sort()
    
for i in range(K):
    if wd[i] == wdl[i]:
        print(wd[i] + 1)

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

work_date = []
count = 0


pw = 0

for d in range(K):

    w = S[pw:].index('o') + pw
    work_date.append(w)

    
    pw = w + C + 1
    

work_date_l = []

Sr = list(reversed(S))
pw = 0

for d in range(K):

    w = Sr[pw:].index('o') + pw
    work_date_l.append((N-1)-w)

    
    pw = w + C + 1

work_date_l.sort()
    
count = 0
for i in range(K):
    if work_date[i] == work_date_l[i]:
        count += 1
        
print(count)

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

work_date = []


pw = 0

for d in range(K):

    w = S[pw:].index('o') + pw
    work_date.append(w)

    
    pw = w + C + 1
    

work_date_l = []

Sr = str(list(reversed(S)))
pw = 0

for d in range(K):

    w = Sr[pw:].index('o') + pw
    work_date_l.append((N-1)-w)

    
    pw = w + C + 1

work_date_l.sort()
    
count = 0
for i in range(K):
    if work_date[i] == work_date_l[i]:
        count += 1
        
print(count)

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

Sr = "".join(list(reversed(S)))

wd = []
wdl = []

pw = 0
pwl = 0

for d in range(K):

    
    while True:
        if S[pw] == ('o'):
            wd.append(pw)
            break
        pw += 1
    pw += C + 1
    
    
    while True:
        if Sr[pwl] == ('o'):
            wdl.append((N-1) - pwl)
            break
        pwl += 1
    pwl += C + 1

wdl.sort()
    
for i in range(K):
    if wd[i] == wdl[i]:
        print(wd[i] + 1)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted