added problem 2 solution using streams