Harryxun/stf_run huggingface dataset:
from collections import deque

m = [deque(input()) for _ in range(3)]
t = 0

while True:
  n = m[t].popleft()
  if not m[t]:
    print('ABC'[t])
    break
  t = n

### FIXED CODE ###

from collections import deque

m = [deque(input()) for _ in range(3)]
t = 0

while True:
  if len(m[t]) == 0:
    print('ABC'[t])
    break
  
  t = 'abc'.find(m[t].popleft())
# -*- coding: utf-8 -*-
# 整数の入力


def main():
    n = int(input())
    h = list(map(int, input().split()))

    result = []
    count = 0
    for i in range(n - 1):
        if h[i] < h[i + 1]:
            result.append(count)
            count = 0
            continue

        count += 1
        if i == n - 2:
            result.append(count)

    print(max(result))


if __name__ == "__main__":
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力


def main():
    n = int(input())
    h = list(map(int, input().split()))

    if n == 1:
        print(0)
        return

    result = []
    count = 0
    for i in range(n - 1):
        if h[i] < h[i + 1]:
            result.append(count)
            count = 0
            continue

        count += 1
        if i == n - 2:
            result.append(count)

    print(max(result))


if __name__ == "__main__":
    main()
import math
N = int(input())
l = []
for i in range(N):
  l = list(map(int, input().split()))

MODp = 1000000007
K = 1
for i in range(N):
  K = math.lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K / l[i])%MODp)

Ans = Ans % MODp
print(Ans)

### FIXED CODE ###

import math
import fractions
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

N = int(input())
l = list(map(int, input().split()))

MODp = 1000000007
K = 1
for i in range(N):
  K = lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K // l[i]))

Ans = Ans % MODp
print(Ans)
a,b,c = map(int, raw_input().split())

if a < b:
  if c < a:
    print(%d,%d,%d) % c,a,b
  elif b < c:
    print(%d,%d,%d) % a,b,c
  else:
    print(%d,%d,%d) % a,c,b

else:
  if c < b:
    print(%d,%d,%d) % c,b,a
  elif a < c:
    print(%d,%d,%d) % b,a,c
  else:
    print(%d,%d,%d) % b,c,a

### FIXED CODE ###

a,b,c = map(int, raw_input().split())

if a > b:
  temp = a
  a = b
  b = temp
if b > c:
  temp = b
  b = c
  c = temp
if a > b:
  temp = a
  a = b
  b = temp

print a,b,c
input()
date = input().split()

minimum = min(date)
maximum = max(date)
total = sum(date)

print(minimum, maximum, total)

### FIXED CODE ###

input()
data = [int(i) for i in input().split()]
  
minimum = min(data)
maximum = max(data)
total = sum(data)
  
print(minimum, maximum, total)
N, M = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(M)]

b = [0]*N

ans = 0
for i in range(N):
    #print(A[i][0])
    if b[A[i][0]-1] ==0:
        b[A[i][0]-1] = A[i][1]
    elif b[A[i][0]-1] == A[i][1]:
        pass
    else:
        ans = -1
        break

s = ''.join([str(N) for N in b])

if ans == 0:
    print(s)
else:
    print(s)

### FIXED CODE ###

n,m = map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]
for i in range(10**n):
    if len(str(i))==n:
        x=str(i)
        for b,c in a:
            if int(x[b-1])!=c:
                break
        else:
            print(i)
            exit()
print(-1)
N = int(input())
L = list(map(int, input().split()))
t = 0
for l in L :
    t += l
t = t - max(L)

    
if max(L) < t:
  print("Yes")
else :
  print("No")

### FIXED CODE ###

a,b = map(int, input().split())
print(a/b)
def parse(s):
    first_val = None
    verticals, horizontals = list(), list()
    seq = 0
    is_horizontal = True
    is_first = True
    for c in s:
        if c == 'T':
            if is_first:
                first_val = seq
                is_first = False
            elif is_horizontal:
                horizontals.append(seq)
            else:
                verticals.append(seq)
            is_horizontal = not is_horizontal
            seq = 0
        else:
            seq += 1
    if seq > 0:
        if is_first:
            first_val = seq
        elif is_horizontal:
            horizontals.append(seq)
        else:
            verticals.append(seq)
    return first_val, verticals, horizontals


def check(vals, target):
    N = sum(vals)
    if N == 0:
        return target == 0
    dp = [0 for _ in range(N + 1)]
    dp[0] = 1
    for v in vals:
        for n in range(N + 1):
            if n + v <= N:
                dp[n + v] = max([dp[n], dp[n + v]])
            if n - v >= 0:
                dp[n - v] = max([dp[n], dp[n - v]])
            else:
                dp[v - n] = max([dp[n], dp[v - n]])
    return dp[abs(target)] == 1


def main():
    S = input()
    X, Y = list(map(int, input().split(' ')))
    fv, vs, hs = parse(S)
    if check(hs, X - fv) and check(vs, Y):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

### FIXED CODE ###

def parse(s):
    first_val = None
    verticals, horizontals = list(), list()
    seq = 0
    is_horizontal = True
    is_first = True
    for c in s:
        if c == 'T':
            if is_first:
                first_val = seq
                is_first = False
            elif is_horizontal:
                horizontals.append(seq)
            else:
                verticals.append(seq)
            is_horizontal = not is_horizontal
            seq = 0
        else:
            seq += 1
    if seq > 0:
        if is_first:
            first_val = seq
        elif is_horizontal:
            horizontals.append(seq)
        else:
            verticals.append(seq)
    return first_val, verticals, horizontals


def check(vals, target):
    val_set = {0}
    for v in vals:
        tmp_set = set()
        for sv in val_set:
            tmp_set.add(sv + v)
            tmp_set.add(sv - v)
        val_set = tmp_set
    return target in val_set


def main():
    S = input()
    X, Y = list(map(int, input().split(' ')))
    fv, vs, hs = parse(S)
    if check(hs, X - fv) and check(vs, Y):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
N = int(input())

c = [[0] for i in range(10)]

for i in range(1, N+1):
    s = str(i)
    c[int(s[0])][int(s[-1])] += 1

ans = 0

for i in range(10):
    for j in range(10):
        ans += c[i][j] * c[j][i]

print(ans)

### FIXED CODE ###

N = int(input())

c = [[0]* 10 for i in range(10)]

for i in range(1, N+1):
    s = str(i)
    c[int(s[0])][int(s[-1])] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += c[i][j] * c[j][i]

print(ans)
h,w = map(int, input().split())

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

if w == 2 and h == 2:
    print(2)
    exit()

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
elif w % 2 == 1 and h == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    print(can)
    exit()
elif w % 2 == 0 and h == 1:
    print(1)
    exit()
else:
    idle = int(w / 2)
    num = idle * 2
    
if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)

### FIXED CODE ###

h,w = map(int, input().split())

if w == 1 or h == 1:
    print(1)
    exit()
    
if w == 2 and h == 2:
    print(2)
    exit()

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
elif w % 2 == 1 and h == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    print(can)
    exit()
elif w % 2 == 0 and h == 1:
    print(1)
    exit()
else:
    idle = int(w / 2)
    num = idle * 2

if h % 2 == 1 and w % 2 == 0:
    print(int((w / 2) * h))
    exit()

if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)
N = int(input())

ans = 0

diclist = []

for i in range(0,N+1):
  temp = list(input())
  temp.sort()
  if temp in diclist:
    ans = ans +1
  else:
    diclist.append(temp)

print(ans)


### FIXED CODE ###

import collections
from scipy.misc import comb

N = int(input())

diclist = []

i=0
while i < N:
  temp = list(input())
  temp.sort()
  tmp_el = ''.join(temp)
  diclist.append(tmp_el)
  i += 1
  
c = collections.Counter(diclist)
clist = list(c.values()) 
ccomb = [comb(clist[i], 2, exact = True) for i in range(0,len(clist))]

print(sum(ccomb))
k = int(input())
a, b = map(int, input())

answer = 'NG'

for i in range(a,b):
    if i % k == 0:
        answer = 'OK'
print(answer)



### FIXED CODE ###

k = int(input())
a, b = map(int, input().split())

answer = 'NG'

for i in range(a,b+1):
    if i % k == 0:
        answer = 'OK'
print(answer)
N = int(input())
S = 0
for i in range(1, N+1):
  S += 1
print(S)

### FIXED CODE ###

IN = input()
OUT = []

for order in IN:
    if order == "B" and len(OUT) != 0:
        OUT.pop()
    elif order == "0" or order == "1":
        OUT.append(order)

print("".join(OUT))
a,b = map(int,input().split())
if (a+b)%3 == 0:
  n = (a+b)/3
  import math
  aa = math.factorial(a-n)
  bb = math.factorial(b-n)
  cc = math.factorial(n)
  print((cc/(bb*aa))%(10**9+7))
else:
  print(0)

### FIXED CODE ###

import math
import numpy as np

def cmb(n, r, mod):
  r = min(r, n-r)
  return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 
N = 10**6
g1 = [1, 1] 
g2 = [1, 1] 
inverse = [0, 1] 

for i in range( 2, N + 1 ):
  g1.append( ( g1[-1] * i ) % mod )
  inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
  g2.append( (g2[-1] * inverse[-1]) % mod )

x,y = map(int,input().split()) 

if (x+y) % 3 == 0:

  A = np.array([[1, 2],
                [2, 1]])

  b = np.array([x, y])

  N = np.linalg.solve(A, b)


  if N[0].is_integer() == True and N[1].is_integer() == True and N[0] >=0 and N[1] >=0:
        
      print(cmb(int(N[0]+N[1]),int(N[0]),mod))

  else:
      print(0)

else:
  print(0)
A, B, C, D = map(int, input().split())

C_s = (A-A%C)//C
C_e = (B-B%C)//C

D_s = (A-A%D)//D
D_e = (B-B%D)//D

C_cnt = C_e - C_s
if A%C==0:
    C_cnt += 1
D_cnt = D_e - D_s
if A%D==0:
    D_cnt += 1

import math
lcm = (C * D) // math.gcd(C, D)

lcm_s = (A-A%lcm)//lcm
lcm_e = (B-B%lcm)//lcm

lcm_cnt = lcm_e - lcm_s
if A%lcm==0:
    lcm_cnt += 1

cnt = C_cnt + D_cnt - lcm_cnt
ans = B - A + 1 - cnt
print(ans)

### FIXED CODE ###

A, B, C, D = map(int, input().split())

C_s = (A-A%C)//C
C_e = (B-B%C)//C

D_s = (A-A%D)//D
D_e = (B-B%D)//D

C_cnt = C_e - C_s
if A%C==0:
    C_cnt += 1
D_cnt = D_e - D_s
if A%D==0:
    D_cnt += 1

import fractions
lcm = (C * D) // fractions.gcd(C, D)

lcm_s = (A-A%lcm)//lcm
lcm_e = (B-B%lcm)//lcm

lcm_cnt = lcm_e - lcm_s
if A%lcm==0:
    lcm_cnt += 1

cnt = C_cnt + D_cnt - lcm_cnt
ans = B - A + 1 - cnt
print(ans)
S=input()
a=S[::2]
b=S[1::2]
if 'L' not in a:
	if 'R' not in b:
		print('Yes')
    else:
		print('No')
else:
	print('No')

### FIXED CODE ###

S=input()
a=S[::2]
b=S[1::2]
if 'L' not in a:
	if 'R' not in b:
		print('Yes')
	elif 'R' in b:
		print('No')
elif 'L' in a:
	print('No')
n = input()

s = abcdefghijklmnopqrstuvwxyz

if n in s:
  print("a")
else:
  print("A")

### FIXED CODE ###

n = input()

s = "abcdefghijklmnopqrstuvwxyz"

if n in s:
  print("a")
else:
  print("A")
while 1:
    n = int(raw_input())
    if n == 0: break
    exist = set([])
    enter = [0]*1000
    bless = [0]*1000
    for loop in xrange(n):
        md,hm,io,p = raw_input().split()
        h,m = map(int,hm.split(":"))
        t = 60*h+m
        p = int(p)
        if io == "I":
            time[p] = t
            exist.add(p)
        else:
            exist.remove(p)
            if p == 0:
                for i in exist: bless[i] += t-max(enter[p],enter[i])
            elif 0 in exist:
                bless[p] += t-max(enter[0],enter[p])
    print max(bless)
    

### FIXED CODE ###

while 1:
    n = int(raw_input())
    if n == 0: break
    exist = set([])
    enter = [0]*1000
    bless = [0]*1000
    for loop in xrange(n):
        md,hm,io,p = raw_input().split()
        h,m = map(int,hm.split(":"))
        t = 60*h+m
        p = int(p)
        if io == "I":
            enter[p] = t
            exist.add(p)
        else:
            exist.remove(p)
            if p == 0:
                for i in exist: bless[i] += t-max(enter[p],enter[i])
            elif 0 in exist:
                bless[p] += t-max(enter[0],enter[p])
    print max(bless)
rate = int(input())
if rate < 1200:
  print("ABC")
else:
  print("ARC)

### FIXED CODE ###

rate = int(input())
if rate < 1200:
  print("ABC")
else:
  print("ARC")
import math

N, A, B = map(int, input().split())

def make():
    b = [1] * A
    r = [0] * B
    return b + r

a = N / (A + B)
a = math.ceil(a)

result = []
for i in range(a):
    result = result + make()

acc = sum(result[0:N])
print(acc)

### FIXED CODE ###

import math

N, A, B = map(int, input().split())

result = 0

a = math.floor(N / (A + B))
r = N % (A + B)

if r > A:
    ad = A
else:
    ad = r

result = A * a + ad
print(result)
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    for j in range(info[i][0]):
        if A[index] < info[i][1]:
            A[index] = info[i][1]
            index += 1
            if index == n:
                break
        else:
            break

ans = sum(A)
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    if index == n:
        break
    for j in range(info[i][0]):
        if index == n:
            break
        if A[index] < info[i][1]:
            A[index] = info[i][1]
            index += 1
        else:
            break

ans = sum(A)
print(ans)
import fractions
N,M = map(int,input().split())
S = input()
T = input()
L = (N * M) // fractions.gcd(N,M)
div_N = L // N
div_M = L // M
tag = (div_N * div_M) // fractions.gcd(div_N,div_M)
count = tag // div_M
s = [""] * L
t = [""] * L

for ss in range(N):
  if ss == 0:
    s[0] = S[0]
    if s[0] != T[0]:
      print(-1)
      exit()
  else:
    s[ss * (div_N)] = S[ss]
#print(L)
#print(s)
#print(tag)
while tag < L:
  if s[tag] != "" and s[tag] != T[count]:
      print(-1)
      exit()
  tag += tag
  count += count
print(L)

### FIXED CODE ###

import fractions
N,M = map(int,input().split())
S = input()
T = input()
G = fractions.gcd(N,M)
L = (N * M) // G
div_N = N // G
div_M = M // G

i = 0
j = 0

while i < N and j < M:
  if S[i] != T[j]:
    print(-1)
    exit()
  else:
    i += div_N
    j += div_M
print(L)
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,M,K = inputMap()
	A = inputList()
	B = inputList()

	sumA = sum(A)
	sumB = sum(B)
	if sumA + sumB <= K:
		print(N+M)
		sys.exit()

		A.append(inf)
		B.append(inf)

	ans = 0
	times = 0

	while True:
		if times > K:
			break

		if A[0] < B[0]:
			times += A[0]
			A = A[1:]
		else:
			times += B[0]
			B = B[1:]
		#print(times)
		ans += 1

	print(ans-1)



#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


### FIXED CODE ###

N, M, K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a, b=[0], [0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])
ans, j=0, M
for i in range(N+1):
    if a[i]>K:
        break
    while b[j]>K-a[i]:
        j-=1
    ans=max(ans, i+j)
print(ans)
S = int(input())
a = S % 100
b = (S- (S % 100))/100
if   b <= 12 and  a<=12 and a!=0 and b!= 0:
       print("AMBIGUOUS")
elif b <= 12 and a!=0 :
       print("MMYY")
elif a<=12 and a!=0  :
       print("YYMM")
else :
      print("NA")

### FIXED CODE ###

n,k=map(int,input().split())
a = input()
 
a = list(a)
a[k - 1] = a[k-1].lower()
a = "".join(a)
print(a)
N = int(input())
B = list(map(int,input().split()))

A = B[1]

for i in range(N):
    if i >= 1:
        if B[i-1] >= B[i]:
          A += B[i-1]
        else:
          A += B[i]
print(A)

### FIXED CODE ###

N = int(input())
B = list(map(int,input().split()))

A = 0

for i in range(N-2):
    if i >= 0:
        if B[i] <= B[i+1]:
            A += B[i]
        else:
            A += B[i+1]
print(A+B[0]+B[N-2])
from collections import deque

N = int(input())
A = list(map(int, input().split()))
Q = deque()
Q.append([0])
cnt = 1
ans = 1
li = []
while Q:
  temp = Q.popleft()
  if len(temp) == cnt and A[cnt]>=0:
    for i in range(2):
      new = temp + [ans]
      Q.append(new)
      li.append(new)
      ans += 1
      A[cnt] -= 1
      if A[cnt]<0:
        break
  else:
    cnt += 1
    if cnt >= N:
      break
  if not Q and cnt<N:
    Q.append(temp)
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

if N == 0 and A[0] != 1:
  print(-1)
elif N != 0 and A[0] != 0:
  print(-1)
else:
  ans = 1
  nodes = 1
  preF = 0
  sucF = sum(A)
  
  for d in range(1, N+1):
    fol = A[d]
    nodes = min((nodes-preF)*2, sucF)
    
    if nodes < fol:
      print(-1)
      exit()
    
    ans += nodes
    preF = fol
    sucF -= fol
  print(ans)
n = int(input())
ans =[]
for i in range(1,n//2+1):
     for j in range(10):
          if i**j < n:
               ans.append(i**j)

print(max(ans))

### FIXED CODE ###

n = int(input())
ans =[]
for i in range(1,n//2+2):
     for j in range(2,10):
          if i**j <= n:
               ans.append(i**j)
print(max(ans))
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 12:41:57 2020

@author: shinba
"""

a,b,h = map(int,input().split())

print(int((a+b)*h/2))


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Fri May 15 12:41:57 2020

@author: shinba
"""

a = int(input())
b = int(input())
h = int(input())

print(int((a+b)*h/2))
N,K = map(int,input().split())
a = list(map(int,input().split()))
s = []
for i in range(N):
    total = 0
    for j in range(i,N):
        total += a[j]
        s.append(total)
s.sort(reverse=True)
m,n = 1,1
while s[0]>=m:
    n += 1
    m *= 2
for i in range(n)[::-1]:
    subs = list(filter(lambda x:x-m>=0,s))
    l = len(subs)
    if l>=K:
        break
    else:
        m //= 2
s = subs[:]
for i in range(n+1):
    subs = list(filter(lambda x:(x//m)%2==1,s))
    l = len(subs)
    if l>=K:
        s = subs[:]
        if l==K:
            break
    m //= 2
ans = s[0]
for i in range(1,K):
    ans &= s[i]
print(ans)


### FIXED CODE ###

N,K = map(int,input().split())
a = list(map(int,input().split()))
s = []
for i in range(N):
    total = 0
    for j in range(i,N):
        total += a[j]
        s.append(total)
s.sort(reverse=True)
m,n = 1,1
while s[0]>=m:
    n += 1
    m *= 2
for i in range(n)[::-1]:
    t = list(filter(lambda x:x-m>=0,s))
    l = len(t)
    if l>=K:
        break
    else:
        m //= 2
n = i+1
for i in range(n):
    u = list(filter(lambda x:(x//m)%2==1,t))
    l = len(u)
    if l>=K:
        t = u[:]
        if l==K:
            break
    m //= 2
ans = t[0]
for i in range(1,K):
    ans &= t[i]
print(ans)
n = int(input())
a = list(map(int, input().split()))
#print(a)
#import functools
#import operator
import numpy

result = np.prod(a)

if result <= 1000000000000000000:
  print(result)
else:
  print(-1)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort()
result = 1
for i in range(len(a)):
  result = result*a[i]
  if result == 0:
    break
  elif result > 1000000000000000000:
    break

if result <= 1000000000000000000:
  print(result)
else:
  print(-1)
a, b = map(int, input().split())
retu = ""
retu += str(a) + str(b)
c**2 = int(retu)
if isinstance(c, int):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a, b = map(int, input().split())
c = str(a) + str(b)
c = int(c)
d = c**(1/2)

if d.is_integer():
    print("Yes")
else:
    print("No")
S=[str(input()) for i in range(2*10^5-1)]
S.pop(0)
print(len(set(S)))

### FIXED CODE ###

N=int(input())
S = [str(input()) for i in range(N)]
print(len(set(S)))
import sys
sys.setrecursionlimit(10000000)
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
import functools
import itertools
import math
INF = float('inf')
MOD = 10**9+7

# Range Minimum query
class SegmentTree:

    def __init__(self, N, INF = INF):
        self.N = 1
        while self.N < N:
            self.N <<= 1
        self.data = [INF for i in range((self.N<<1)-1)]

    def update(self, k, a):
        k += self.N-1
        self.data[k] = a
        while k > 0:
            k = (k-1)>>1
            self.data[k] = min(self.data[(k<<1)+1], self.data[(k<<1)+2])

    def RmQ(self, a, b, k=0, l=0, r=-1):
        if r == -1: r = self.N
        if r <= a or b <= l:
            return INF
        if a <= l and r <= b:
            return self.data[k]
        vl = self.RmQ(a, b, (k<<1)+1, l, (l+r)>>1)
        vr = self.RmQ(a, b, (k<<1)+2, (l+r)>>1, r)
        return min(vl, vr)

N, M = map(int, input().split())
S = input()
dp = SegmentTree(N+1)
dp.update(0, 0)
for i in range(1, N+1):
    if S[i] == '0':
        c = dp.RmQ(max(0, i-M), i)
        if c != INF:
            dp.update(i, c+1)
G = dp.RmQ(N, N+1)
if G == INF:
    print(-1)
    exit()
minv = [INF] * N
for i in range(N)[::-1]:
    if S[i] == '0':
        x = dp.RmQ(i, i+1)
        minv[x] = i
minv[G] = N
x = 0
vs = []
while x <= G:
    vs.append(minv[x])
    x += 1
vs = vs[::-1]
ans = [vs[i]-vs[i+1] for i in range(len(vs)-1)]
print(*ans[::-1], sep = ' ')


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
import functools
import itertools
import math
INF = float('inf')
MOD = 10**9+7

def dijkstra_path(s, edges):
    dist = [INF for i in range(len(edges))]
    dist[s], h, p = 0, [], [-1]*len(edges)
    heappush(h, (0, s))
    while (len(h)):
        dv, v = heappop(h)
        if dv > dist[v]:
            continue
        for u, cost in edges[v]:
            tmp = dv+cost
            if tmp < dist[u]:
                dist[u] = tmp
                p[u] = v
                heappush(h, (tmp, u))
    return dist, p

N, M = map(int, input().split())
S = input()
ids = []
for i, x in enumerate(S):
    if x == '0':
        ids.append(-i)
ids = ids[::-1]
l = len(ids)
es = [[] for i in range(N+1)]
for i in range(N, 0, -1):
    es[i].append((-ids[min(l-1, bisect_right(ids, -i+M)-1)], 1))
d, p = dijkstra_path(N, es)
if d[0] == INF:
    print(-1)
    exit()
vs = []
v = 0
while v != -1:
    vs.append(v)
    v = p[v]
ans = [vs[i+1]-vs[i] for i in range(len(vs)-1)]
print(*ans, sep = ' ')
import sympy
N=int(input())
ans=0
for i in range(1,N+1):
  ans+=sympy.divisor_count(i)*i
print(ans)

### FIXED CODE ###

N=int(input())
ans=(N*(N+1))//2  #1の時
for i in range(2,N+1):
  m=N//i
  ans+=i*(m*(m+1)//2)
print(ans)
n = int(input())
a = map(int,input().split())
ans = 1
for i in n:
    ans *= i
if ans > 10**18 :
    ans = -1
print(ans)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
    print(0)
    quit()
ans = 1
for i in a:
    ans *= i
    #print(i)
    if ans > 10**18:
        ans = -1
        break
print(ans)
k = "a",
for _ in range(int(input()) - 1):
  k = {a + b for a in r for b in a + chr(ord(max(a)) + 1)}
print(*sorted(k), sep='\n')

### FIXED CODE ###

k = "a",
for _ in range(int(input()) - 1):
  k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
print(*sorted(k), sep='\n')
a = int(input())
l = input()
s = 0 
for i in l :
  if i == "#":
    t = 1
  if t and i == ".":
    s+=1
  
print(s)

### FIXED CODE ###

input()
S=input()
dot=S.count(".")
ans=dot
count=0
for s in S:
    if s=="#":count+=1
    else:dot-=1
    ans=(min(ans,count+dot))
print(ans)