Add c, cpp, and java solutions to challenge 18