object main extends App {
  val sc = new java.util.Scanner(System.in)
  val problems = sc.nextInt
  val submissions = sc.nextInt; sc.nextLine()
  val scores: List[String] = List.fill(submissions)(sc.nextLine())
  val records: List[(Int, String)] = scores.map(_.split(" "))
    .map(x => (x(0).toInt, x(1)))
  records.foreach(println)
  println(go(records, 0, 0, 0, ""))
  def go (records: List[(Int, String)], acs: Int, was: Int, qn: Int, la: String): (Int, Int) = records match {
    case Nil => (acs, was)
      // 正答すみの問題は次の問題までスキップする。
    case h::t if la == "AC" && qn == h._1 => go(t, acs, was, h._1, h._2)
      // 新規問題で正解のパターン。
    case h::t if qn != h._1 && h._2 == "WA" => go(t, acs, was + 1, h._1, h._2)
    case h::t if qn != h._1 && h._2 == "AC" => go(t, acs + 1, was, h._1, h._2)
//    case h::t if h._2 == "WA" => go(t, acs, was + 1, h._1, h._2)
    case h::t if h._2 == "AC" => go(t, acs + 1, was, h._1, h._2)
  }
}
