if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n, q = map(int, input().split())
    s = input()

    new_s = '0' + s + '1'

    ans_list = [1] + [0]*n + [1]

    operate = [[0,0] for _ in range(q)]

    direction = {'L':-1, 'R':1}
    top = 0
    bottom =  n-1

    for i in range(q):
        k = operate[i]
        k[0], k[1] = input().split()
    for t, d in operate[::-1]:
        if d == 'R':
            if s[bottom] == 't':
                bottom -= 1
        else:
            if s[top] == 't':
                top += 1
    print(max([0,bottom-top+1]))
