package main

import (
	"fmt"
)

var masu []Masu

type Masu struct {
	Index int
	Key   string
	Value int
}

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

	for i := 0; i < n; i++ {
		str := s[i : i+1]
		m := Masu{Index: i, Key: str, Value: 1}
		masu = append(masu, m)
	}

	for i := 0; i < q; i++ {
		var t, d string
		fmt.Scan(&t, &d)

		if d == "R" {
			calc(t, d, n)
		} else if d == "L" {
			calc(t, d, n)
		}
	}
	var sum int
	for i := 1; i < n; i++ {
		m := masu[i]
		sum += m.Value
	}

	fmt.Println(sum)
}

func calc(target, dir string, n int) {
	for i := 0; i < n; i++ {
		ma := &masu[i]
		if ma.Key == target {
			num := ma.Value
			ma.Value = 0
			if ma.Index != 0 && dir == "L" {
				masu[i-1].Value += num
			} else if ma.Index != n-1 && dir == "R" {
				masu[i+1].Value += num
			}
		}
	}
}
