solved five in ruby