Problem 019, C++