import java.util.*

/**
 * Created on 2019/03/03.
 */



fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.next().toInt()
    val q = sc.next().toInt()
    val mass = IntArray(n) { 1 }
    var res = n
    val str = sc.next().toCharArray()
    val lLast = str[0].toInt() - 65
    val rLast = str.last().toInt() - 65
    val massPaths = Array(26) { LinkedList<Int>() }.let {
        str.slice(1 until (n - 1)).forEachIndexed { i, e ->
            it[e.toInt() - 65].add(i + 1)
        }

        it.map { ll -> ArrayList(ll) }
    }

    for (exceeded in 0 until q) {
        val t = sc.next().toCharArray()[0].toInt() - 65
        if (sc.next() == "L") {
            if (lLast == t) {
                res -= mass[0]
                mass[0] = 0
            }
            for (e in massPaths[t]) {
                mass[e-1] += mass[e]
                mass[e] = 0
            }
        } else {
            for (e in massPaths[t]) {
                mass[e+1] += mass[e]
                mass[e] = 0
            }
            if (rLast == t) {
                res -= mass[n-1]
                mass[n-1] = 0
            }
        }
    }

    print(res)
}
