require 'pp'

N,Q = readline.chomp.split.map(&:to_i)
S = readline.chomp

OPS = Q.times.each.map { readline.chomp.split }


def reverse_search(pos, idx)
  return 1 if idx < 0
  c,dir = OPS[idx]
  npath = 0
  if dir == 'L'
    if S[pos] != c
      npath += reverse_search(pos, idx-1)
    end
    if pos != N-1 and S[pos+1] == c
      npath += reverse_search(pos+1, idx-1)
    end
  else # dir == 'R'
    npath = 0
    if S[pos] != c
      npath += reverse_search(pos, idx-1)
    end
    if pos != 0 and S[pos-1] == c
      npath += reverse_search(pos-1, idx-1)
    end
  end
  # pp [pos,idx,npath]
  return npath
end

# pp reverse_search( N-1, -1 )
# pp reverse_search( N-1, 6 )

count = 0
OPS.each_with_index do |(c,dir),i|
  if dir == 'L' and c == S[0]
    # reverse search from -1 i to 0
    count += reverse_search(0, i-1)
  elsif dir == 'R' and c == S[-1]
    count += reverse_search(N-1, i-1)
  end
end
puts N-count
