#! /usr/bin/env python
# -*- coding: utf-8 -*-

def SearchIdx(s, c):
    idx = []
    for i in range(0,len(s)):
        if(s[i] == c):
            idx.append(i)
    return idx
if __name__ == '__main__':
    N, Q = map(int, input().split())
    sN = list(input())
    sp = []
    for i in range(0, Q):
        t, d = input().split()
        sp.append({'t': t, 'd': d})
    for ts in sp:
        res = SearchIdx(sN, ts['t'])
        if(len(res) > 0):
            if(ts['d'] == 'L'):
                rev = res
                rev.reverse()
                for i in rev:
                    if(i == 0):
                        sN[i] = None
                    else:
                        sN[i], sN[i-1] = sN[i-1], sN[i]
            elif(ts['d'] == 'R'):
                for i in res:
                    if(i == len(sN)-1):
                        sN[len(sN)-1] = None
                    else:
                        sN[i], sN[i+1] = sN[i+1], sN[i]

    sN.remove(None)
    print(len(sN))