Tantangan
Diberikan daftar nama warna unik sebagai input, urutkan mereka dalam urutan yang pertama kali muncul di Amazing Technicolor Dreamcoat Joseph .
Contoh
Input: green, blue, red, brown
Output: red, green, brown, blue
Daftar lengkap warna, secara berurutan, adalah:
1. red
2. yellow
3. green
4. brown
5. scarlet
6. black
7. ochre
8. peach
9. ruby
10. olive
11. violet
12. fawn
13. lilac
14. gold
15. chocolate
16. mauve
17. cream
18. crimson
19. silver
20. rose
21. azure
22. lemon
23. russet
24. grey
25. purple
26. white
27. pink
28. orange
29. blue
Atau sebagai array string:
["red","yellow","green","brown","scarlet","black","ochre","peach","ruby","olive","violet","fawn","lilac","gold","chocolate","mauve","cream","crimson","silver","rose","azure","lemon","russet","grey","purple","white","pink","orange","blue"]
Aturan
- Anda dapat mengambil input dengan cara yang masuk akal dan nyaman (misalnya, serangkaian string, string yang dibatasi, string individual) selama diizinkan oleh aturan I / O standar kami , tetapi harap tentukan metode input Anda dalam jawaban Anda.
- Anda dapat melakukan hal yang sama untuk output Anda.
- Input hanya akan berisi warna dari daftar di atas.
- Solusi Anda harus dapat menangani input kosong.
- Anda dapat memilih apakah semua kata dalam input secara konsisten adalah huruf besar, huruf kecil atau judul huruf tetapi casing output Anda harus cocok dengan input Anda.
- Ini adalah kode-golf sehingga jumlah byte terendah dalam setiap bahasa menang.
- Seperti biasa, lubang standar dilarang.
Uji kasus
Input: []
Output: []
Input: ["green", "blue", "red", "brown"]
Output: ["red", "green", "brown", "blue"]
Input: ["gold", "grey", "green"]
Output: ["green", "gold", "grey"]
Input: ["ruby","yellow","red","grey"]
Output: ["red", "yellow", "ruby", "grey"]
Input: ["gold", "green", "fawn", "white", "azure", "rose", "black", "purple", "orange", "silver", "ruby", "blue", "lilac", "crimson", "pink", "cream", "lemon", "russet", "grey", "olive", "violet", "mauve", "chocolate", "yellow", "peach", "brown", "ochre", "scarlet", "red"]
Output: ["red", "yellow", "green", "brown", "scarlet", "black", "ochre", "peach", "ruby", "olive", "violet", "fawn", "lilac", "gold", "chocolate", "mauve", "cream", "crimson", "silver", "rose", "azure", "lemon", "russet", "grey", "purple", "white", "pink", "orange", "blue"]