Programming contests

ECN selejtező programozó csapatverseny, 2019. április 17.

April 17, 2019 10:15 AM – April 17, 2019 3:15 PM

True Alphabetic Sorting

By a strange coincidence, nearly every spell learned at Hogwarts is an anagram of an English word or phrase that means the same thing! Professor McGonagall wants to write a dictionary for these words. Each word will be stored by its sorted anagram, meaning that the letters will be the same, but will now be in sorted order. This seems easy enough, BUT the letters aren't to be sorted in ASCII order; instead, they are to be sorted as follows: 'A', then 'a', then 'B', then 'b', and so forth.

Input Specification

The input will consist of one or more words, each containing up to ten letters. The words can be preceded, followed, and separated by any number of spaces and newline characters. The final word will be “END” in uppercase. This word is not to be processed; it merely signals the end of the input.

Output Specification

The output cases are to appear in the same order in which they appear in the input. Each word is to be sorted and put into the output, each followed by a newline character. Be sure it's formatted properly; in particular, you are not to copy the white space from the input to the output. No matter how the input is formatted, you should put one word per line (as specified) in the output.

Sample Input

  1. Voldemort
  2. Abba
  3. END
download as text file

Output for Sample Input

  1. delmoortV
  2. Aabb
download as text file

Original Problem

NMU Invitational Programming Contest, 2001

University of Debrecen; Faculty of Informatics; v. 03/01/2019