rankall.R correct solution