simple algorithm needed

Hi everybody!

I am I course IT student and I have some experience so I do not expect the program itself but only the idea please.

The program I must create is very simple. I have created many more complex programs but I do not why i can not understand how to create this program though i am not high in the moment.

so the program must read an input file that contains a list of words that are separated by a space. then the program must output the words in a file in an alphabetical sequence sorting the words alphabetically only by the first letter but not by any other of the letters next to the first letter
AND
those words that start with the same letter must be in opposite sequence.
so that means that this sequence:

green apple gold account gin almond ability

would be transformed in:

ability almond account apple gin gold green

so i need just the idea not program itself. can anybody help me please?
Represent your words as string/index pairs (index is the position at which the word appears in the file).
For the desired order, one of the pairs is considered lower than the other if either its first letter is lower or the first letters are equal and its index is greater.
Topic archived. No new replies allowed.