Added Java solution of second problem
Added an Ocaml solution of second problem