grid , spell = map ( int , input ().split())
mas = list(input())
g = [1]*grid
g.insert (0,0)
g.append (0)
# マスの左右に消滅枠追加
for a in range(spell):
    moji , way = input().split()
    if way == "R" :
        w = 1
    else:
        w = -1
    move = [i for i, x in enumerate(mas) if x == moji]
    for m in move :
        movenum = g[m+1]
        g[m+1] = 0
        g[m+1+w] += movenum
ansl = g[0]
ansr = g[-1]
lost =ansl+ansr
ans = grid - lost
print (ans)