open System.Text.RegularExpressions let doIt () = let patterns = [Regex("^digi .*(?i)nyo[^a-zA-Z0-9]{0,3}$"); Regex("^petit .*(?i)nyu[^a-zA-Z0-9]{0,3}$"); Regex("^gema .*(?i)gema[^a-zA-Z0-9]{0,3}$"); Regex("^piyo .*(?i)pyo[^a-zA-Z0-9]{0,3}$"); Regex("^rabi .*[a-zA-Z0-9]");] let isCorrect line = patterns |> Seq.map (fun p -> p.IsMatch(line)) |> Seq.exists id seq { let mutable line = stdin.ReadLine () while line <> null do yield line line <- stdin.ReadLine () } |> Seq.map (fun l -> match isCorrect l with | true -> "CORRECT (maybe)" | false -> "WRONG!") |> Seq.iter (printfn "%s") doIt ()