additional solution to p4 ruby