enhance get_shortest_n_longest

use 'reduce' and 'lambda'