Added a detailed solution for the first word problem.