package main

import (
    "fmt"
)

func main() {
    var n, q int
    fmt.Scan(&n, &q)

    var s []byte
    fmt.Scan(&s)

    m := make(map[byte]map[int]int)
    for _, b := range []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZ") {
        m[b] = make(map[int]int)
    }
    for i, b := range s {
        m[b][i] = 1
    }

    var del int
    for i := 0; i < q; i++ {
        var ts, ds []byte
        fmt.Scan(&ts, &ds)
        t := ts[0]
        d := ds[0]

        switch d {
        case 'L':
            for j, c := range m[t] {
                if j == 0 {
                    del += c
                } else {
                    m[s[j-1]][j-1] += c
                }
                delete(m[t], j)
            }
        case 'R':
            for j, c := range m[t] {
                if j == n-1 {
                    del += c
                } else {
                    m[s[j+1]][j+1] += c
                }
                delete(m[t], j)
            }
        }
    }

    fmt.Println(n - del)
}
