Exercise 4: modified method to select students' names according to lenght