(java) Solved problem 47
(java) Solved problem 44