let rec count r b lst = match lst with | [] -> if r > b then "RED" else "BLUE" | first :: rest -> if first = "RED" then count (r+1) b rest else count r (b+1) rest let () = let lst = Scanf.scanf "%s\n%s\n%s\n" (fun a b c -> [a; b; c]) in Printf.printf "%s\n" (count 0 0 lst)