N, Q = map(int, input().split())

s = list(input())

t = [0] * Q
d = [0] * Q

for i in range(Q):
    t[i], d[i] = input().split()
    # print(t[i], d[i])

# def my_index_multi(l, x):
#     return [i for i, _x in enumerate(l) if _x == x]
#
#
#
#
# for i in range(Q):
#     t[i]
#     s_in = [x for x in s if t[i] in x]

# 各マスに存在するGolemの数を表す
Golem = [1] * N

for j in range(Q):
    for i, string in enumerate(s):
        if t[j] == string:
            print(t[j], s[i])
            if d[j] == "L":
                print(d[j])
                if i == 0:
                    Golem[i] = 0
                    print(Golem)
                else:
                    if Golem[i - 1] != 0:
                        Golem[i - 1] += 1
                    if Golem[i] != 0:
                        Golem[i] -= 1
                    print(Golem)
            else:
                print(d[j])
                if i == N - 1:
                    Golem[i] = 0
                    print(Golem)
                else:
                    if Golem[i + 1] != 0:
                        Golem[i + 1] += 1
                    if Golem[i] != 0:
                        Golem[i] -= 1
                    print(Golem)

print(Golem)
ans = sum(Golem)
print(ans)