Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. [Image] 

The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is at some cell of the field. The spiders move all the time, and each spider always moves in one of the four directions (left, right, down, up). In a unit of time, a spider crawls from his cell to the side-adjacent cell in the corresponding direction. If there is no cell in the given direction, then the spider leaves the park. The spiders do not interfere with each other as they move. Specifically, one cell can have multiple spiders at the same time.

Om Nom isn't yet sure where to start his walk from but he definitely wants:  to start walking at time 0 at an upper row cell of the field (it is guaranteed that the cells in this row do not contain any spiders);  to walk by moving down the field towards the lowest row (the walk ends when Om Nom leaves the boundaries of the park). 

We know that Om Nom moves by jumping. One jump takes one time unit and transports the little monster from his cell to either a side-adjacent cell on the lower row or outside the park boundaries.

Each time Om Nom lands in a cell he sees all the spiders that have come to that cell at this moment of time. Om Nom wants to choose the optimal cell to start the walk from. That's why he wonders: for each possible starting cell, how many spiders will he see during the walk if he starts from this cell? Help him and calculate the required value for each possible starting cell.


-----Input-----

The first line contains three integers n, m, k (2 ≤ n, m ≤ 2000; 0 ≤ k ≤ m(n - 1)). 

Each of the next n lines contains m characters — the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of the field is empty; otherwise, the character in the line will equal one of the four characters: "L" (meaning that this cell has a spider at time 0, moving left), "R" (a spider moving right), "U" (a spider moving up), "D" (a spider moving down). 

It is guaranteed that the first row doesn't contain any spiders. It is guaranteed that the description of the field contains no extra characters. It is guaranteed that at time 0 the field contains exactly k spiders.


-----Output-----

Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.


-----Examples-----
Input
3 3 4
...
R.L
R.U

Output
0 2 2 
Input
2 2 2
..
RL

Output
1 1 
Input
2 2 2
..
LR

Output
0 0 
Input
3 4 8
....
RRLL
UUUU

Output
1 3 3 1 
Input
2 2 2
..
UU

Output
0 0 


-----Note-----

Consider the first sample. The notes below show how the spider arrangement changes on the field over time:

...        ...        ..U       ...

R.L   ->   .*U   ->   L.R   ->  ...

R.U        .R.        ..R       ...





Character "*" represents a cell that contains two spiders at the same time.  If Om Nom starts from the first cell of the first row, he won't see any spiders.  If he starts from the second cell, he will see two spiders at time 1.  If he starts from the third cell, he will see two spiders: one at time 1, the other one at time 2.

Difficulty: interview

Starter code:

Solutions:
n, m, k = list(map(int, str.split(input())))
f = tuple([str.strip(input()) for _ in range(n)])

r = []
for x in range(m):

    cr = sum([f[y][x] == "U" for y in range(0, n, 2)])
    for cx in range(max(0, x + 1 - n), x):

        cr += f[x - cx][cx] == "R"

    for cx in range(x + 1, min(m, n + x)):

        cr += f[cx - x][cx] == "L"

    r.append(cr)

print(str.join(" ", list(map(str, r))))


def ans():
    n, m, k = map(int, input().split())
    a = list([] for i in range(n))
    s = [0]*m
    for i in range(n):
        a[i] = input()
    for i in range(1,n):
        for j in range(m):
            if i < m-j and a[i][j+i] == 'L':
                s[j]+=1
            if i <= j and a[i][j-i] == 'R':
                s[j]+=1
            if i+i < n and a[i+i][j] == 'U':
                s[j]+=1
    print(*s)
ans()

# -*- coding: utf-8 -*-
import sys
f = sys.stdin

n, m, k = map(int, f.readline().strip().split())

s = f.readline().strip()
sp = [0]*m

for i in range(1, n):
    s = f.readline().strip()
    for l in range(m):
        if s[l]=='U':
            if i % 2 == 0:
                sp[l] += 1
        elif s[l]=='R':
            mi = l+i 
            if mi<m :
                sp[mi] += 1
        elif s[l]=='L':
            mi = l-i 
            if mi>=0 :
                sp[mi] += 1
    #print(i, s, sp)

print(' '.join([str(it) for it in sp]))

def solve():
    answer = [0] * m
    for i in range(1, n):
        for j in range(m):
            if j - i >= 0:
                if park[i][j - i] == 'R':
                    answer[j] += 1
            if j + i < m:
                if park[i][j + i] == 'L':
                    answer[j] += 1
            if 2 * i < n:
                if park[2 * i][j] == 'U':
                    answer[j] += 1
    return answer

n, m, k = tuple(map(int, input().split()))
park = [input() for i in range(n)]
print(' '.join(map(str, solve())))


n, m, k = map( int, input().split() )
ans = [0] * m

for i in range( n ):
    field = input()
    for j in range( m ):
        if ( field[j] == 'U' ) and ( i % 2 == 0 ): ans[j] += 1
        elif ( field[j] == 'L' ) and ( j >= i ): ans[j - i] += 1
        elif ( field[j] == 'R' ) and ( j + i < m ): ans[j + i] += 1

print ( ' '.join( map( str, ans ) ) )

n, m, k = map(int, input().split())
input()
s = [0] * m
for i in range(1, n):
    for j, x in enumerate(input()):
        if x == 'L':
            if j - i >= 0: s[j - i] += 1
        elif x == 'R':
            if j + i < m: s[j + i] += 1
        elif x == 'U' and i & 1 == 0: s[j] += 1
print(' '.join(map(str, s)))

def f():
    n, m, k = list(map(int, input().split()))
    s = []
    a = []
    for i in range(n):
        s.append(input())
    for j in range(m):
        ans = 0
        for i in range(n):
            if i + i < n and s[i + i][j] == 'U':
                ans += 1
            if j - i >= 0 and s[i][j - i] == 'R':
                ans += 1
            if j + i < m and s[i][j + i] == 'L':
                ans += 1
        a.append(ans)        
    print(' '.join(map(str, a)))
f()
        


def f():
    n, m, k = list(map(int, input().split()))
    a = []
    for i in range(n):
        a.append(list(input().strip()))
    res = [0 for i in range(m)]
    for j in range(m):
        for i in range(1, n):
            if j - i >= 0 and a[i][j - i] == 'R':
                res[j] += 1
            if j + i < m and a[i][i + j] == 'L':
                res[j] += 1
            if i + i < n and a[i + i][j] == 'U':
                res[j] += 1
    print(' '.join(list(map(str, res))))
f()        
                
            


Rows, Columns = 0, 0
Spiders = []

def ReadInput():
    nonlocal Rows, Columns, Spiders
    Rows, Columns, spiderCount = map(int, input().split())
    Spiders = [0 for i in range(0, Columns)]
    for x in range(0, Rows):
        line = input()
        for y in range(0, Columns):
            if line[y] == 'L':
                if y - x >= 0:
                    Spiders[y - x] += 1
            elif line[y] == 'R':
                if y + x < Columns:
                    Spiders[y + x] += 1
            elif line[y] == 'U':
                if x % 2 == 0:
                    Spiders[y] += 1

def PrintOutput():
    nonlocal Rows, Columns, Spiders
    for y in range(0, Columns):
        print(Spiders[y], end = " ")
    print("\n")

def main():
    ReadInput()
    PrintOutput()

main()

I = lambda:map(int,input().split())
n,m,k = I()
f = [['.' for _ in range(m)] for _ in range(n)]
for i in range(n):
    s = input()
    for j in range(len(s)):
        if s[j] != '.':
            f[i][j] = s[j]
ans = [0] * m
for i in range(n):
    for j in range(m):
        if j - i >= 0 and f[i][j - i] == 'R':
            ans[j] += 1
        if j + i < m and f[i][j + i] == 'L':
            ans[j] += 1
        if f[0][j] == 'D':
            ans[j] += 1
        if i + i < n and f[i + i][j] == 'U':
            ans[j] += 1
print (*ans)

n,m,k=[int(x) for x in input().split()]
park=[input() for i in range(n)]
answers=[0]*m
for inot in range(n):
    for j in range(m):
        if park[inot][j]!='.':
            i=(j,inot,park[inot][j])
            if i[2]=='R':
                if i[0]+i[1]<m:
                    answers[i[0]+i[1]]+=1
            elif i[2]=='L':
                if i[0]-i[1]>=0:
                    answers[i[0]-i[1]]+=1
            elif i[2]=='U':
                if not i[1]&1:
                    answers[i[0]]+=1
for i in answers:
    print(i,end=' ')

n, m, k = list(map(int, input().split()))
field = []
counts = []
for j in range(m):
  counts.append(0)
for i in range(n):
  row = list(input())
  field.append(row)

for i in range(n):
  for j in range(m):
    if field[i][j] == "L":
      jth = j - i
      if jth >= 0:
        counts[jth] += 1
    elif field[i][j] == "R":
      jth = i + j
      if jth < m:
        counts[jth] += 1
    elif field[i][j] == "U":
      if i % 2 == 0:
        counts[j] += 1

#counts = []
#for j in range(m):
#  count = 0
#  for i in range(n):
#    if newfield[i][j] == "S":
#      count += 1
#  counts.append(str(count))

#print(field)
#print(newfield)
print(" ".join(list(map(str, counts))))



import re
import inspect
from sys import argv, exit

def rstr():
    return input()

def rint():
    return int(input())

def rints(splitchar=' '):
    return [int(i) for i in input().split(splitchar)]

def varnames(obj, namespace=globals()):
    return [name for name in namespace if namespace[name] is obj]

def pvar(var, override=False):
    prnt(varnames(var), var)

def prnt(*args, override=False):
    if '-v' in argv or override:
        print(*args)

class Spider():
    def __init__(self, x, y, d):
        self.x = x
        self.y = y
        self.d = d

    def get_copy(self):
        return Spider(self.x, self.y, self.d)

    def move(self):
        if self.d == 'R':
            self.x += 1
        elif self.d == 'L':
            self.x -= 1
        elif self.d == 'U':
            self.y -= 1
        elif self.d == 'D':
            self.y += 1
        else:
            raise Exception('WHAT HAVE YOU DONE', self.d)

def main(i, n, m, lders, rders, uders):
    sightings = 0
    
    iders = [s for s in uders if s.x == i and s.y % 2 == 0]
    sightings += len(iders)
    prnt('id', len(iders))
   
    ulders = [s for s in rders if s.y == (i - s.x)]
    sightings += len(ulders)
    prnt('uld', len(ulders))
  
    urders = [s for s in lders if s.y == (s.x - i)]
    sightings += len(urders)
    prnt('urd', len(urders))
    
    return str(sightings)
        

def __starting_point():
    (n,m,k) = rints()
    field = [rstr() for i in range(n)]

    si = [0 for i in range(m)]
    spiders = []
    for j,row in enumerate(field):
        for i,space in enumerate(row):
            if space == 'R':
                if i+j < len(si):
                    si[i+j] += 1
            if space == 'L':
                if i-j >= 0:
                    si[i-j] += 1
            if space == 'U':
                if j % 2 == 0:
                    si[i] += 1

    print(' '.join([str(i) for i in si]))


__starting_point()

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

ans = [0] * m



for i in range( n ):

    field = input()

    for j in range( m ):

        if ( field[j] == 'U' ) and ( i % 2 == 0 ): ans[j] += 1

        elif ( field[j] == 'L' ) and ( j >= i ): ans[j - i] += 1

        elif ( field[j] == 'R' ) and ( j + i < m ): ans[j + i] += 1



print( ' '.join( map( str, ans ) ) )



# Made By Mostafa_Khaled


class CodeforcesTask436BSolution:
    def __init__(self):
        self.result = ''
        self.n_m_k = []
        self.field = []

    def read_input(self):
        self.n_m_k = [int(x) for x in input().split(" ")]
        for x in range(self.n_m_k[0]):
            self.field.append(input())

    def process_task(self):
        result_row = [0 for x in range(self.n_m_k[1])]
        for x in range(self.n_m_k[0]):
            for y in range(self.n_m_k[1]):
                # print(x, y)
                field = self.field[x][y]
                if field == "R":
                    pos = y + x
                    if pos < self.n_m_k[1]:
                        result_row[pos] += 1
                elif field == "L":
                    pos = y - x
                    if pos >= 0:
                        result_row[pos] += 1
                elif field == "U" and not x % 2:
                    result_row[y] += 1
        self.result = " ".join([str(x) for x in result_row])

    def get_result(self):
        return self.result


def __starting_point():
    Solution = CodeforcesTask436BSolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())

__starting_point()

n,m,k=map(int,input().split())
seen = [0 for _ in range(m)]

for i in range(n):
  S = list(input())
  for j in range(m):
    if S[j] == 'U' and not i&1:
      seen[j]+=1
    elif S[j] == 'L' and j-i>=0:
      seen[j-i]+=1
    elif S[j] == 'R' and j+i<m:
      seen[j+i]+=1

print(*seen, sep=" ")

n,m,k=map(int,input().split())
seen = [0 for _ in range(m)]
 
for i in range(n):
  S = list(input())
  for j in range(m):
    if S[j] == 'U' and not i&1:
      seen[j]+=1
    elif S[j] == 'L' and j-i>=0:
      seen[j-i]+=1
    elif S[j] == 'R' and j+i<m:
      seen[j+i]+=1
 
print(*seen, sep=" ")


n,m,k=map(int,input().split())
seen = [0 for _ in range(m)]
 
for i in range(n):
  S = list(input())
  for j in range(m):
    if S[j] == 'U' and not i&1:
      seen[j]+=1
    elif S[j] == 'L' and j-i>=0:
      seen[j-i]+=1
    elif S[j] == 'R' and j+i<m:
      seen[j+i]+=1
 
print(*seen, sep=" ")