Adding solution to problem #2.
Merge pull request #1 from addercop/problem2

Adding solution to problem #2.