Solve problems 32,39,43,52 using Ruby.