Harryxun/stf_run huggingface dataset:
h,w = map(int, input().split())
maze = [input() for i in range(h)]
route = [[0] * w for i in range(h)]
white = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == '.':
            white += 1
 
 
class MyStack:
    def __init__(self):
        self.stack = []
    def push(self, item_1, item_2):
        self.stack.append([item_1,item_2])
    def pop(self):
        result = self.stack.pop(0)
        return result[0],result[1]
 
 
def min_route():
    global h,w
    stack = MyStack()
    stack.push(1,1)
    route[0][0] = 0
    n = 0
    while n <= h*w:
        y,x = stack.pop()
        route_num = route[y-1][x-1] + 1
        if y != h:
            if maze[y][x-1] == '.' and route[y][x-1] == 0:
                stack.push(y+1,x)
                route[y][x-1] += route_num
        if y != 1:
            if maze[y-2][x-1] == '.' and route[y-2][x-1] == 0:
                stack.push(y-1,x)
                route[y-2][x-1] += route_num
        if x != w:
            if maze[y-1][x] == '.' and route[y-1][x] == 0:
                stack.push(y,x+1)
                route[y-1][x] += route_num
        if x != 1:
            if maze[y-1][x-2] == '.' and route[y-1][x-2] == 0:
                stack.push(y,x-1)
                route[y-1][x-2] += route_num
        if route[h-1][w-1]  != 0:
            return route[h-1][w-1]
        n += 1
    print(-1)
    exit()
 
ans = white - min_route() - 1
 
if ans < 0:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

h,w = map(int, input().split())
maze = [input() for i in range(h)]
route = [[0] * w for i in range(h)]
white = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == '.':
            white += 1
 
 
class MyStack:
    def __init__(self):
        self.stack = []
    def push(self, item_1, item_2):
        self.stack.append([item_1,item_2])
    def pop(self):
        result = self.stack.pop(0)
        return result[0],result[1]
 
 
def min_route():
    global h,w
    stack = MyStack()
    stack.push(1,1)
    route[0][0] = 0
    n = 0
    while len(stack.stack) >= 1:
        y,x = stack.pop()
        route_num = route[y-1][x-1] + 1
        if y != h:
            if maze[y][x-1] == '.' and route[y][x-1] == 0:
                stack.push(y+1,x)
                route[y][x-1] += route_num
        if y != 1:
            if maze[y-2][x-1] == '.' and route[y-2][x-1] == 0:
                stack.push(y-1,x)
                route[y-2][x-1] += route_num
        if x != w:
            if maze[y-1][x] == '.' and route[y-1][x] == 0:
                stack.push(y,x+1)
                route[y-1][x] += route_num
        if x != 1:
            if maze[y-1][x-2] == '.' and route[y-1][x-2] == 0:
                stack.push(y,x-1)
                route[y-1][x-2] += route_num
        if route[h-1][w-1]  != 0:
            return route[h-1][w-1]
        n += 1
    print(-1)
    exit()
 
ans = white - min_route() - 1
 
if ans < 0:
    print(-1)
else:
    print(ans)
L = []
L2 = []
for _ in range(5):
    a = input()
    if a[-1] == "0":
        L.append(int(a))
    else:
        last = int(a[-1])
        L.append(int(a) + 10 - last)
        L2.append(last)
print(sum(L) + min(L2) - 10)

### FIXED CODE ###

L = []
L2 = []
for _ in range(5):
    a = input()
    if a[-1] == "0":
        L.append(int(a))
    else:
        last = int(a[-1])
        L.append(int(a) + 10 - last)
        L2.append(last)
if not L2:
    print(sum(L))
else:
    print(sum(L) + min(L2) - 10)
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 20:41:22 2020

@author: liang
"""
from scipy.special import comb
#D
key = 10**9 + 7
S = int(input())

#かご
n = S//3

ans = 0
for i in range(1,n+1):
    #玉
    a = S - 3*i 
    tmp = int(comb(i-1+a,i-1))
    tmp %= key
    ans += tmp
    ans %= key
    #print("print:",i,ans,tmp)
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 20:41:22 2020

@author: liang
"""
"""
float => int への変換誤差あり。
scipy.special.comb()は返り値がfloat
math.factorial()で自分で実装する。（大きな値のとき）
"""
#from scipy.special import comb
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
#D
key = 10**9 + 7
S = int(input())

#かご
n = S//3

ans = 0
for i in range(1,n+1):
    #玉
    a = S - 3*i 
    #tmp = int(comb(i-1+a,i-1))
    tmp = combinations_count(i-1+a,i-1)
    tmp %= key
    ans += tmp
    ans %= key
    #print("print:",i,ans,tmp)
print(ans)
t=input().split()
m=t.pop
n=int(m)
if len(set(t))==n:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

n=int(input())
t=input().split()
if len(set(t))==n:
    print("YES")
else:
    print("NO")
L = input()

print(pow(L/3,3))


### FIXED CODE ###

L = int(input())
print(pow(L/3,3))
n,k = map(int,input().split())
num = int(n/2) + 1
if n!=2&&num>=k:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

n,k = map(int,input().split())
if n%2==0:
    num = int(n/2)
else:
    num = int(n/2) + 1
if num>=k:
    print('YES')
else:
    print('NO')
def ENT(m,n):
    if n==0:
        return 1
    else:
        return (ENT(m,n-1)*m)%1000000007

m,n=[int(i) for i in input().split(" ")]

print(ENT(m,n))

### FIXED CODE ###

from functools import lru_cache
mod=1000000007

m,n=[int(i) for i in input().split(" ")]

@lru_cache()
def power(m,n,mod):
    if n==0:
        return 1
    elif n==1:
        return m
    elif n%2==0:
        return ((power(m,n//2,mod)%mod) * (power(m,n//2,mod)%mod))%mod
    else:
        return (power(m,n-1,mod)*m)%mod

print(power(m,n,mod))
n,a,b,c,d = map(int,input().split())
s = input()

def judge(start,goal):
    for i in range(start,goal-1):
        if s[i] == "#" and s[i+1] == "#":
            return 0
    return 1

def full_judge (start,obst,obfin,goal):
    if s[obst-2] = "." and s[obst] == "." :
        return 1
    for i in range(start-1,goal-2):
        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            return 1
    return 0


if c<b:
    if (judge(a,c) and judge(b,d)):
        print("Yes")
    else:
        print("No")
elif c<d:
    if (judge(a,c) and judge(b,d)):
        print("Yes")
    else:
        print("No")
else:
    if judge(b,d) and full_judge(a,b,d,c) and judge(a,c):
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

n,a,b,c,d = map(int,input().split())
s = input()

def judge(start,goal):
    for i in range(start,goal-1):
        if s[i] == "#" and s[i+1] == "#":
            return 0
    return 1

def full_judge (start,obst,obfin,goal):
    if s[obst-2] == "." and s[obst] == "." :
        return 1
    for i in range(obst-1,obfin-1):
        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            return 1
    return 0


if c<b:
    if (judge(a,c) and judge(b,d)):
        print("Yes")
    else:
        print("No")
elif c<d:
    if (judge(a,c) and judge(b,d)):
        print("Yes")
    else:
        print("No")
else:
    if judge(b,d) and full_judge(a,b,d,c) and judge(a,c):
        print("Yes")
    else:
        print("No")
def hoge(num):
  for i in range(num):
    if(num % (2 * i) != 0):
      return i
n = int(input())
print(sum(list(map(lambda x: hoge(int(x)), input().split()))))


### FIXED CODE ###

def hoge(num):
  for i in range(10**10):
    if(num % (2 ** i) != 0):
      return i - 1
    
n = int(input())
print(sum(list(map(lambda x: hoge(int(x)), input().split()))))
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int,input().split())
uf = UnionFind(n)

for _ in range(m):
    a , b = map(int,input().split())
    uf.union(a , b)
    
print(len(uf.all_group_members())-1)


### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int,input().split())
uf = UnionFind(n)

for _ in range(m):
    a , b = map(lambda x:int(x)-1,input().split())
    uf.union(a , b)
    
print(uf.group_count()-1)
def main(h):
  count = 1
  n = 0
  if i in range (k):
    n = (n * 10 + 7) % k  
    if n == 0:
      break 
      print(count)
      return 0
    count += 1
  print(-1)
  
if __name__ == '__main__':
	k = int(input())
    main(k)

### FIXED CODE ###

k = int(input())
count = 1
n = 0
if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
  while 1:
      n = (n * 10 + 7) % k  
      if n == 0:
        break 
      count += 1
  print(count)
N = input()

try:
	if 0 <= int(N) <= 999:
      if N[-1] is '2' or '4' or '5' or '7' or '9':
        print('hon')
      elif N[-1] is '0' or '1' or '6' or '8':
        print('pon')
      elif N[-1] is '3':
        print('bon')
except ValueError:
  exit()


### FIXED CODE ###

N = input()

try:
  if 0 <= int(N) <= 999:
    if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
      print('hon')
    elif N[-1] == '0' or N[-1] =='1' or N[-1] =='6' or N[-1] =='8':
      print('pon')
    elif N[-1] == '3':
      print('bon')
except ValueError:
  exit()
n = int(input())
a_list = list(map(int, input().split()))

co = a_list.copy()
co.sort()
if 0 in co:
    co.remove(0)

if not len(co) % 2 == 0:
    print(0)
    quit()



for index in range(len(a_list)[:-1:2]):
    if not a_list[index] == a_list[index + 1]:
        print(0)
        quit()




print(int(pow(2, floor(n / 2))) % (pow(10,9) + 7))

### FIXED CODE ###

from math import factorial, floor
n = int(input())
a_list = list(map(int, input().split()))

co = a_list.copy()
if 0 in co:
    co.remove(0)
co.sort()


if not len(co) % 2 == 0:
    print(0)
    quit()

for index in range(len(a_list))[:-1:2]:
    if not co[index] == co[index + 1]:
        print(0)
        quit()


print(int(pow(2, floor(n / 2))) % (pow(10,9) + 7))
print(*input().sep(","))

### FIXED CODE ###

print(*input().split(","))
N, M = map(int, input().split())
P = []
Y = []
var = []
for i in range(M):
    p, y = map(int, input().split())
    if p not in P:
        var.append(p)
    P.append(p)
    Y.append(y)

L = zip(range(M), P, Y)     

Order = [None]*M

for v in var:
    l = filter(lambda x:x[1] == v, L)
    l_ = sorted(l, key = lambda x:x[2])
    
    for n in l_:
        Order[n[0]] = l_.index(n)+1
        
for (p, od) in zip(P, Order):
    print('{0:0>6d}{1:0>6d}'.format(p, od))

### FIXED CODE ###

N, M = map(int, input().split())
L = []
P = [0]*(N+1)
for i in range(M):
    p, y = map(int, input().split())
    L.append([i, p, y, 0])

L = sorted(L, key = lambda x:x[2])

for l in L:
    P[l[1]] += 1
    l[3] = P[l[1]]    
        
for l in sorted(L, key = lambda x:x[0]):
    print('{0:0>6d}{1:0>6d}'.format(l[1], l[3]))
N=int(input())
s=" "
for i in range(N):
    s.append(input())
print("AC x "+s.count("AC"))
print("WA x "+s.count("WA"))
print("TLE x "+s.count("TLE"))
print("RE x "+s.count("RE"))

### FIXED CODE ###

N=int(input())
s=[]
for i in range(N):
    s.append(input())
print("AC x ",s.count("AC"))
print("WA x ",s.count("WA"))
print("TLE x ",s.count("TLE"))
print("RE x ",s.count("RE"))
H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])
print(sum([sum(map(lambda a: 0 if a == -1 else C[a][1], row)) for row in A])

### FIXED CODE ###

#http://abc079.contest.atcoder.jp/
# -*- coding: utf-8 -*-

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

mp = []
for _ in range(10):
    mp.append(list(map(int,input().split())))

wall = []
for _ in range(h):
    wall.append(list(map(int,input().split())))

def min_cost(i,j,current,min_cost_current):
    if i == j: return current
    for index in range(10):
        if i == index: continue
        if current + mp[i][index] < min_cost_current:
            min_cost_current = min_cost(index,j,current+mp[i][index],min_cost_current)
    return min_cost_current


mp_min_cost =[]
for i in range(10):
    tmp = []
    for j in range(10):
        if i == j :
            tmp.append(0)
            continue

        min_cost_current = mp[i][j]
        if min_cost_current == sorted(mp[i])[1]:
            tmp.append(mp[i][j])
            continue

        # from i to j
        for index in range(10):
            if i == index: continue
            if mp[i][index] < min_cost_current:
                min_cost_current = min_cost(index,j,mp[i][index],min_cost_current)
        tmp.append(min_cost_current)
    mp_min_cost.append(tmp)

amount = 0
for i in wall:
    for j in i:
        if j == -1 or j == 1: continue
        amount += mp_min_cost[j][1]
print(amount)
p = str(input())
s = list(p)
k = int(input())

zisyo = []
for i in range(len(s)):
    count = 0
    st = s[i]

    zisyo.append(st)
    onelist = list(sorted(list(set(zisyo))))
    
    if onelist[st] > 6:
        continue
    while count <= n:
        count = count + 1
        try:
            st = st + s[i + count]
            zisyo.append(st)
        except:
            pass
    
zisyosort = list(sorted(list(set(zisyo))))
print(zisyosort)

### FIXED CODE ###


s = str(input())
k = int(input())
kouho = [s]

for i in range(len(s)):
    for plus in range(k+1):
        st = s[i:i + plus]
        kouho.append(st)
so = list(sorted(set(kouho)))
if '' in so:
    so.remove('')
    
print(so[k-1])
N, K = list(map(int, input().split()))
dp = [[1] + [0 for i in range(K)] for j in range(N-K+2)]

for i in range(1, N-K+2):
    for j in range(1, K+1):
        dp[i][j] = dp[i-1][j] + dp[i-1][j-1]

for i in range(1, K+1):
    print((dp[N-K+1][i] * dp[K-1][i-1]) % (10**9+7))

### FIXED CODE ###

N, K = list(map(int, input().split()))
dp = [[1] + [0 for i in range(K)] for j in range(N+1)]

for i in range(1, N+1):
    for j in range(1, K+1):
        dp[i][j] = dp[i-1][j] + dp[i-1][j-1]

for i in range(1, K+1):
    print((dp[N-K+1][i] * dp[K-1][i-1]) % (10**9+7))
n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = raw_input().split()
  u = int(str[0])
  k = int(str[1])
  for j in range(k):
    v = int(str[2+j])
    c = int(str[3+j])
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]

d[0] = 0
color[0] = 1

while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
    print minv
  if u == -1:
    break
  color[u] = 2

for i in range(n):
  if d[i]==inf:
    print '-1'

### FIXED CODE ###

n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = map(int, raw_input().split())
  u = str[0]
  k = str[1]
  for j in range(k):
    v = str[2+2*j]
    c = str[3+2*j]
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]
 
d[0] = 0
color[0] = 1
 
while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
  if u == -1:
    break
  color[u] = 2
  for v in range(n):
    if color[v]!=2 and M[u][v]!=inf:
      if d[v]>d[u]+M[u][v]:
        d[v] = d[u] + M[u][v]
        color[v] = 1
for i in range(n):
  if d[i]==inf:
    print '%d -1' % i
  else:
    print '%d %d' % (i, d[i])
n=int(input())
t,a=map(int,input().split())
H=list(map(int,inpt().split()))
minn=10**10
for i in range(n):
  if minn>t*(1000)-6*H[i]:
    ans = H[i]
    minn=t*(1000)-6*H[i]
print(ans)
  

### FIXED CODE ###

n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
minn=10**10
for i in range(n):
  if minn>abs((t*(1000)-6*H[i])-a*1000):
    ans = i
    minn=abs((t*(1000)-6*H[i])-a*1000)
print(ans+1)
import collections
def dp(node,cache,edge):
  if node in cache:
    return cache[node]
  lcl_max=0
  for child in edge[node]:
    dp[child]=dp(child,cache,edge)
    lcl_max=max(lcl_max,1+dp[child])
  return lcl_max

max_dis=0
cache,edge={},collections.defaultdict(list)
n,m=map(int,input().split())
for _ in range(m):
  a,b=map(int,input().split())
  edge[a].append(b)
for node in range(1,n+1):
  max_dis=max(max_dis,dp(node,cache,edge))

  
  


### FIXED CODE ###

import collections
import sys
sys.setrecursionlimit(10**9)
cache,edge={},collections.defaultdict(list)
def dp(node):
  if node in cache:
    return cache[node]
  lcl_max=0
  for child in edge[node]:
    
    lcl_max=max(lcl_max,1+dp(child))
  cache[node]=lcl_max
  return lcl_max
 
max_dis=0

n,m=map(int,input().split())
for _ in range(m):
  a,b=map(int,input().split())
  edge[a].append(b)
for node in range(1,n+1):
  max_dis=max(max_dis,dp(node))
print(max_dis)
if a * b * 2  == 1:
    print('odd')
else:
    print('Even')

### FIXED CODE ###

a,b = map(int,input().split())
 
print("Even" if (a * b) % 2 == 0 else "Odd" )
t=int(input())
if t>=30:
  print("Yes")
 else:
  print("No")

### FIXED CODE ###

t=int(input())
if t>=30:
  print("Yes")
else:
  print("No")
c=input()
if c=a or c=e or c=i or c=o or c=u
print("vowel")
else
print("constant")

### FIXED CODE ###

c = input()
if c == "a" or c == "e" or c == "i" or c == "o" or c == "u":
  print("vowel")
else:
  print("consonant")
import heapq
from collections import defaultdict
v_num = int(input())
edges = defaultdict(list)
for i in range(v_num):
    data = [int(n) for n in input().split(" ")[1:]]
    for j in range(i + 1, v_num):
        if data[j] != -1:
            edges[i].append([data[j], j])
            edges[j].append([data[j], i])
queue = []
heapq.heapify(queue)
for c in edges[0]:
    heapq.heappush(queue, c)
visited = {0}
answer = 0
while len(visited) < v_num:
    q = heapq.pop(queue)
    weight, one = q[0], q[1]
    if one in visited:
        continue
    answer += weight
    for e in edges[one]:
        heapq.heappush(queue, e)
    visited |= {one}
print(answer)

### FIXED CODE ###

import heapq
from collections import defaultdict
v_num = int(input())
edges = defaultdict(list)
for i in range(v_num):
    data = [int(n) for n in input().split(" ")[1:]]
    for j in range(i + 1, v_num):
        if data[j] != -1:
            edges[i].append([data[j], j])
            edges[j].append([data[j], i])
queue = []
heapq.heapify(queue)
for c in edges[0]:
    heapq.heappush(queue, c)
visited = {0}
answer = 0
while len(visited) < v_num:
    q = heapq.heappop(queue)
    weight, one = q[0], q[1]
    if one in visited:
        continue
    answer += weight
    for e in edges[one]:
        if e[1] not in visited:
            heapq.heappush(queue, e)
    visited |= {one}
print(answer)
n = int(input())
a = list(map(int,input().split()))
b = tuple(a)
a.sort()
A1 = a[N//2-1]
A2 = a[N//2]
med = (A1+A2)/2
for i in range(N):
    if b[i] <= med:
        print(A2)
    else:
        print(A1)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = tuple(a)
a.sort()
A1 = a[n//2-1]
A2 = a[n//2]
med = (A1+A2)/2
for i in range(n):
    if b[i] <= med:
        print(A2)
    else:
        print(A1)
x,y,z=map(int,input().split())
print(z+' '+x+' '+y)

### FIXED CODE ###

x,y,z=map(str,input().split())
print(z+' '+x+' '+y)
import sys
 
def INPUT(): return sys.stdin.readline().strip()
 
sys.setrecursionlimit(10 ** 9)
 
 
def main():
    S = INPUT()
    fall_point = []
    split_point = [0]
    N = len(S)
    Last_S = [0] * N
 
    for i in range(N):
        if not i == N - 1:
            if S[i:i+2] == 'RL':
                fall_point.append(i)
            elif S[i:i+2] == 'LR':
                split_point.append(i+1)
        else:
            split_point.append(i+1)
 
    for i in range(len(split_point)-1):
        sub_len = split_point[i+1] - split_point[i]
 
        if sub_len % 2 == 0:
            last_S[fall_point[i]] = sub_len // 2
            last_S[fall_point[i] + 1] = sub_len // 2
        else:
            if (split_point[i+1] - fall_point[i]) % 2 == 0:
                last_S[fall_point[i]] = sub_len // 2
                last_S[fall_point[i] + 1] = sub_len // 2 + 1
            else:
                last_S[fall_point[i]] = sub_len // 2 + 1
                last_S[fall_point[i] + 1] = sub_len // 2
 
    print(" ".join(map(str, last_S)))
 
 
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
 
def INPUT(): return sys.stdin.readline().strip()
 
sys.setrecursionlimit(10 ** 9)
 
 
def main():
    S = INPUT()
    fall_point = []
    split_point = [0]
    N = len(S)
    last_S = [0] * N
 
    for i in range(N):
        if not i == N - 1:
            if S[i:i+2] == 'RL':
                fall_point.append(i)
            elif S[i:i+2] == 'LR':
                split_point.append(i+1)
        else:
            split_point.append(i+1)
 
    for i in range(len(split_point)-1):
        sub_len = split_point[i+1] - split_point[i]
 
        if sub_len % 2 == 0:
            last_S[fall_point[i]] = sub_len // 2
            last_S[fall_point[i] + 1] = sub_len // 2
        else:
            if (split_point[i+1] - fall_point[i]) % 2 == 0:
                last_S[fall_point[i]] = sub_len // 2
                last_S[fall_point[i] + 1] = sub_len // 2 + 1
            else:
                last_S[fall_point[i]] = sub_len // 2 + 1
                last_S[fall_point[i] + 1] = sub_len // 2
 
    print(" ".join(map(str, last_S)))
 
 
if __name__ == '__main__':
    main()
import numpy as np
import math

A, B, H, M = map(int, input().split())

time = H + (M / 60.0)
a_rot = (time / 12.0) * np.pi * 2
b_rot = (M / 60.0) * np.pi * 2

rot = a_rot - b_rot
if rot < 0:
    rot = b_rot - a_rot


ans = math.sqrt(A**2 + B**2 - (2 * A * B * np.cos(rot)))

print(ans)


### FIXED CODE ###

import numpy as np
import math

A, B, H, M = map(int, input().split())

time = H + (M / 60.0)
a_rot = (time / 12.0) * np.pi * 2
b_rot = (M / 60.0) * np.pi * 2

rot = a_rot - b_rot
if rot < 0:
    rot = b_rot - a_rot


ans = math.sqrt(A**2 + B**2 - (2 * A * B * np.cos(rot)))

print(ans)
import sys
s = input()
n = 0
l = len(s)
for i in range(l):
  j = l-i-1
  if i>=j:
    print(n)
    return
  if s[i]!=s[j]:
    n = n+1
print(n)
return

### FIXED CODE ###

import sys
s = input()
n = 0
l = len(s)
for i in range(l):
  j = l-i-1
  if i>=j:
    print(n)
    exit(0)
  if s[i]!=s[j]:
    n = n+1
print(n)
exit(0)
import math
import sys
args = sys.argv
A = int(args[1])
P = int(args[2])

if 0<=A and P<=100 :
    Pi = math.floor((3*A +P)/2)
    print(Pi)
else :
    print("ERROR")

### FIXED CODE ###

import math

A,P=map(int, input().split())

if 0<=A and P<=100 :
    Pi = math.floor((3*A +P)/2)
    print(Pi)
else :
    print("ERROR")