Problem03.rb, the solution devided into two parts. comments will be refactored  later