let ans (s, t) (a, b) u =
  if s = u then (a - 1, b) else (a, b - 1)

let () =
  let (s, t) = Scanf.sscanf (read_line ()) "%s %s" (fun s1 s2 -> (s1, s2))
  in
  let (a, b) = Scanf.sscanf (read_line ()) "%d %d" (fun n1 n2 -> (n1, n2))
  in
  let u = read_line ()
  in
  let t = ans (s, t) (a, b) u
  in
  Printf.printf "%d %d" (fst t) (snd t)
