You want to arrange a group of students so that their heights are in non-descending order, and boys and girls alternate with each other.
You will be given a String[] students. Each element of students will be in the format "name height sex" (quotes for clarity only), where height is an integer in centimeters and sex is either "boy" or "girl" (quotes for clarity only). Return a String containing a dash-separated list of the students' names in the desired order. If multiple return values are possible, return the one that comes first lexicographically. If there is no possible ordering, return "" (empty String). Note that dashes ('-') come earlier lexicographically than letters.
|