Rewrite Problem7's solution using streams