package main

import "fmt"

func main() {
	var n, q int
	var s string
	fmt.Scan(&n, &q, &s)
	ar := make([]int, n)
	for i := range ar {
		ar[i] = 1
	}
	mp := map[rune][]int{}
	for i, v := range s {
		if _, ok := mp[v]; ok {
			mp[v] = append(mp[v], i)
		} else {
			mp[v] = []int{i}
		}
	}
	for i := 0; i < q; i++ {
		var t, d string
		fmt.Scan(&t, &d)
		a := mp[rune(t[0])]
		if rune(d[0]) == 'L' {
			for _, v := range a {
				val := ar[v]
				ar[v] = 0
				if v != 0 {
					ar[v-1] += val
				}
			}
		} else {
			for _, v := range a {
				val := ar[v]
				ar[v] = 0
				if v != len(ar)-1 {
					ar[v+1] += val
				}
			}
		}
	}
	sum := 0
	for _, v := range ar {
		sum += v
	}
	fmt.Println(sum)
}
