fork download
  1. open Array;;
  2. open String
  3. (* Common part *)
  4. let (|>) x f = f x
  5. let identity = fun x -> x
  6.  
  7. let flip f y x = f x y
  8.  
  9. let readInStr _ = Scanf.scanf "%d " identity
  10. let readIntLn _ = Scanf.scanf "%d\n" identity
  11. (* Programme *)
  12. let numofC s c =
  13. let rec numof' i acc =
  14. try let i = index_from s i c
  15. in numof' i (acc+1)
  16. with Not_found -> acc
  17. in (numof' 0 0)
  18. let main () =
  19. let k = readIntLn()
  20. in let str = Array.make k (Scanf.scanf "%s\n" identity)
  21. in let n = readIntLn ()
  22. in let ic = Array.make n (Scanf.scanf "%d %c\n" (function x y -> (x,y))) |> fast_sort(function x y->(fst x) - (fst y))
  23. in let tbl = Hashtbl.create k in
  24. String.iter ( fun c -> add tbl (1+ (find tbl c)) str
  25. for i = n-1 to 0 do
  26. let a = fst ic.(i) in
  27. let num = find str (snd ic.(i)) in
  28. (str.(a/num)).[a mod num]<- " "
  29. done;
  30. Array.iter (String.iter (function c->
  31. if c <> " " then print_char c
  32. )) str
  33. ;;
  34. main()
  35.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
File "prog.ml", line 22, characters 61-62:
Syntax error
stdout
Standard output is empty