def moveGolemToRight(golems, i):
    if i != n - 1:
        print('i=' + str(i))
        golems[i + 1] += golems[i]
    golems[i] = 0
    return golems


def moveGolemToLeft(golems, i):
    if i != 0:
        golems[i - 1] += golems[i]
    golems[i] = 0
    return golems


def move(golems, addresses, t, d):
    i = 0
    for address in addresses:
        print('影響を受ける住所=' + address)
        print('それは何番目=' + str(i))
        if t == address:
            if d == 'R':
                print('moveRight')
                print('セル' + str(i))
                golems = moveGolemToRight(golems, i)
            else:
                print('moveLeft')
                print('セル' + str(i))
                golems = moveGolemToLeft(golems, i)
        i += 1
    return golems


def makeAddresses(str, n):
    addresses = []
    for char in str:
        addresses.append(char)
    return addresses


n, q = [int(i) for i in input().split()]
addresses = makeAddresses(input(), n)

golems = [1] * n
print(golems)
for i in range(q):
    t, d = input().split()
    print(str(i) + '回目の呪文')
    golems = move(golems, addresses, t, d)
    print(golems)
    print('===')

print(sum(golems))
