Solved prob012 and 013