The program must print the alphabet four times: first in the normal alphabetical order, second in the order of a qwerty keyboard, third in the order of a dvorak keyboard, and lastly in reverse alphabetical order. The output should resemble this:


The output is not case-sensitive, and you can add or omit newlines or spaces wherever you wish.

The catch: the program must be less than 104 characters, or, in other words, smaller than the length of the alphabet times four.

I will accept the answer with the shortest code, unless I see something really clever or interesting that I am more impressed with.

EDIT: I will accept the shortest answer on Wednesday, 4/27/2011.

EDIT2: And the winner is (as usual) Golfscript in 64 chars! Second place, which is behind by only three chars, is also in Golfscript, with 67 chars, followed by Bash in third place with 72 chars.

But there were a few others I wanted to mention, such as this one, which, depending on your definition, only used 52 "characters", and this one where he wrote it in a language he created.

There were a few people who broke an unwritten rule and did not qualify, but I will mention them just for their way of thinking without the box.

  • 11
    \$\begingroup\$ Consider using a bounty for an answer that impressed you. I think accepting an answer in a code-golf should always be the natural criterion (i.e. length). \$\endgroup\$ – Joey Apr 23 '11 at 16:00
  • \$\begingroup\$ I lost using Tcl: tio.run/… \$\endgroup\$ – sergiol Jul 25 '17 at 22:19

37 Answers 37


Deorst, 39 bytes


Try it online!

How on Earth is Deorst beating everything bar Jelly???

How it works

Ef             - Push the lowercase alphabet
  EuE|         - Push 'qwerty…vbnm'
      '…'      - Push that string
         Ef    - Push the alphabet
           VE; - Reverse and concatenate

PHP - 45

I don't know if this is concidered cheating or not :)

  • \$\begingroup\$ Only solution of its kind! :D +1 \$\endgroup\$ – Ry- Apr 27 '11 at 4:31
  • \$\begingroup\$ @minitech: I posted a similar solution in Python, longer but with more correct output, before this. \$\endgroup\$ – jscs Apr 27 '11 at 20:16
  • \$\begingroup\$ Okay, upvoted also. But this is shorter. Also not sure how you can have "more" correct output (it is correct). \$\endgroup\$ – Ry- Apr 27 '11 at 21:00
  • \$\begingroup\$ @minitech: this prints the entire contents of the page, where mine prints only the requested output -- the four orderings of the alphabet. No big deal, though, it's all just for fun. Thanks for the upvote! :) \$\endgroup\$ – jscs Apr 28 '11 at 21:01
  • \$\begingroup\$ @minitech: my mistake; I assumed this was pointing to this page. Apologies to you and to Nicklas. \$\endgroup\$ – jscs Apr 28 '11 at 22:43

Bash, 109

a(){ printf "$@";}
v=`a "\%o" {97..122}`
a $v
a qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz
a $v|rev



Mouse-2002, 99 bytes




RProgN, 62 Bytes Noncompeting

a S . "qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz" a

I'm a bit disappointed RProgN didn't exist at the time of this question. It could have won something!

Try it Online!


Scala, 128 Bytes

Not golfy enough, but readable :)

val l=("qwertyuiopasdfghjklzxcvbnm","pyfgcrlaoeuidhtnsqjkxbmwvz");List(l._1,l._1.sorted,l._2,l._2.sorted.reverse).mkString("\n")

Jelly, 25 bytes


Try it online!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.