# 57. 机场航班调度
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.on('line', function(line) {
let flights = input.split(',');
flights.sort((s1, s2) => {
let order = '$&*0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for(let i=0; i<2; i++) {
let diff = order.indexOf(s1[i]) - order.indexOf(s2[i]);
if (diff !== 0) {
return diff;
}
}
return s1.slice(2) - s2.slice(2);
});
console.log(flights.join(','));
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19