9
The challenge is to make a program that sorts a list of words, only that the words need to be in the order of a random given alphabet.
Your program will accept a string of comma-separated words and a new alphabet.
Your program will output every word in the same way in the new sorted order.
Example:
Input:
home,oval,cat,egg,network,green bcdfghijklmnpqrstvwxzaeiouy
Output:
cat,green,home,network,egg,oval
This is a code-golf, so the winner is the person with the shortest program.
This is my first challenge so any improvements to the question/challenge are appreciated.
May we take the inputs in a form that is more appropriate to the language? E.g. two separate inputs; a character matrix with one word on each line, and a character vector of letters. A list of strings. Etc. – Adám – 2016-03-10T17:21:55.840
>
@Dennis yes to both – Mathetic – 2014-10-04T20:53:35.467
1That is a mistake. I will edit that. – Mathetic – 2014-10-04T21:24:44.013
+1 OK question (for a first try ;-)). But I'm not seeing the relevance of the title - perhaps you can rename it to
Sort by custom alphabet
or something more creative? – Digital Trauma – 2014-10-04T21:45:31.987@DigitalTrauma Yeah that might be better. I tried to play a little with the words. I aimed for a reference to ascii and utf-8 and the like to ask which it is. But that one failed. I'll change it to your suggestion which was better. – Mathetic – 2014-10-04T22:05:08.073