fun main(args: Array<String>) {
	val input = (readLine() ?: return).split(" ")
	val n = input[0].toInt()
	val q = input[1].toInt()
	val s = (readLine() ?: return).toCharArray()

	val cache = Array<LinkedList<Int>>(26) { LinkedList() }
	for (i in 0 until n) cache[s[i]-'A'].add(i)

	val golem = IntArray(n) { 1 }
	var sum = n
	for (i in 0 until q) {
		val line = (readLine() ?: return)
		val t = cache[line[0]-'A']
		if (line[2] == 'L') {
			for (p in 0 until t.size) {
				if (p == 0) {
					sum -= golem[p]
					golem[p] = 0
				} else {
					golem[p - 1] += golem[p]
					golem[p] = 0
				}
			}
		} else {
			for (p in t.size - 1 downTo 0) {
				if (p == n - 1) {
					sum -= golem[p]
					golem[p] = 0
				} else {
					golem[p + 1] += golem[p]
					golem[p] = 0
				}
			}
		}
	}
	println(sum)
}