package main

import (
    "fmt"
)

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

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

    cnts := make([]int, n)
    idx := make(map[byte][]int)
    for i, b := range s {
        cnts[i] = 1
        idx[b] = append(idx[b], i)
    }

    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 := range idx[t] {
                if j == 0 {
                    del += cnts[j]
                } else {
                    cnts[j-1] += cnts[j]
                }
                cnts[j] = 0
            }
        case 'R':
            for k := len(idx[t]) - 1; k >= 0; k-- {
                j := idx[t][k]
                if j == n-1 {
                    del += cnts[j]
                } else {
                    cnts[j+1] += cnts[j]
                }
                cnts[j] = 0
            }
        }
    }

    fmt.Println(n - del)
}
