let R() = stdin.ReadLine() type Turn = FstPlayer | SndPlayer let (|Oda|Yukiko|) = function | x when x = "oda" -> Oda | _ -> Yukiko let (|Odd|Eve|) n = match n % 2 with | 1 -> Odd | _ -> Eve let playerName fstMove (turn:Turn) = match fstMove, turn with | Oda, FstPlayer | Yukiko, SndPlayer -> "oda" | _ -> "yukiko" let judge (board:string[]) = let charaDist= board |> Array.map(fun x -> x.ToCharArray()) |> Array.concat |> Array.countBy(fun x -> x) |> Map.ofArray let blackNum = charaDist |> Map.find 'b' let whiteNum = charaDist |> Map.find 'w' match abs(blackNum - whiteNum) with | Eve -> Turn.FstPlayer | Odd -> Turn.SndPlayer [] let main _ = let GRID_NUM = 8 let S = R() let B = Array.init GRID_NUM (fun _ -> R()) judge B |> function | FstPlayer as t -> playerName S t | SndPlayer as t -> playerName S t |> printfn "%s" 0