Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

71%
+3 −0
Challenges Sort letters by height

Given a sequence of lower case letters, sort them into order of height. Heights The heights of letters are dependent on font, so for this challenge the height order to be used is as defined below...

5 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 1y ago by Taeir‭

#1: Initial revision by user avatar trichoplax‭ · 2022-10-30T16:52:20Z (about 2 years ago)
Sort letters by height
Given a sequence of lower case letters, sort them into order of height.


## Heights
The heights of letters are dependent on font, so for this challenge the height order to be used is as defined below:

```text
acemnorsuvwxz
t
i
bdfghklpqy
j
```

Letters on the same line are defined to be the same height. The first line is the shortest letters, the last line is the tallest letter.

## Input
- A sequence of lower case letters
- This may be a string or any data structure of characters

## Output
- A sequence of the same letters in sorted order
- This may be a string or any ordered data structure of characters. It does not need to match the input format (provided it is consistent between inputs)
  - For example, you may take input as an array of characters, and output as a string, provided this format does not change for different inputs
- The sort does not need to be stable (letters that are the same height do not need to remain in the same order as the input, even if the input was already sorted)
- The sort may be either ascending or descending

## Test cases
Since the sort order can be either ascending or descending, and the sort does not need to be stable, most inputs will have many possible valid outputs. The test cases are in the format `"input" : ["valid", "outputs"]`. You may choose any of the valid outputs, but you must output only one of them.

```text
"a" : ["a"]
"aa" : ["aa"]
"atibj" : ["atibj", "jbita"]
"tick" : ["ctik", "kitc"]
"now" : ["now", "nwo", "onw", "own", "wno", "won"]
"just" : ["jtus", "jtsu", "sutj", "ustj"]
"pjztyix" : ["xztipyj", "zxtipyj", "xztiypj", "zxtiypj", "jypitzx", "jypitxz", "jpyitzx", "jpyitxz"]
```

> Explanations are optional, but I'm more likely to upvote answers that have one.