Print the alphabet four times

37

4

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:

abcdefghijklmnopqrstuvwxyz
qwertyuiopasdfghjklzxcvbnm
pyfgcrlaoeuidhtnsqjkxbmwvz
zyxwvutsrqponmlkjihgfedcba

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.

Peter Olson

Posted 2011-04-23T15:29:42.797

Reputation: 7 412

11Consider 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). – Joey – 2011-04-23T16:00:13.030

Answers

16

Python 2, 97 characters

q="qwertyuiopasdfghjklzxcvbnm"
a="".join(sorted(q))
print a,q,"pyfgcrlaoeuidhtnsqjkxbmwvz",a[::-1]

Sorting QWERTY and converting back from list to string is shorter than the alphabet itself!*

Another option for generating the alphabet in fewer characters than the alphabet itself:

print map(chr,range(65,91))

Although this prints a Python list of characters.

There's not much to be done here in the way of data compression; jamming the letters into 5 bits only saves 39 characters, which isn't a lot if you then have to un-jam them (and you still have to represent the bytes literally); it looks like zlib (just as an example) saves fewer than 20 bytes; encoding the sequence as a list of deltas to the next letter still takes 5 bits for each delta, because the largest in this sequence is -22:

[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
 1, 1, 1, 1, 1, 1, 1, -9, 6, -18, 13, 2, 5, -4, -12, 6, 
 1, -15, 18, -15, 2, 1, 2, 1, 14, -2, -21, 19, -20, 12, 
 -1, 3, 9, -19, 1, -4, 15, -6, -11, 14, -10, 16, -12, -5, 
 4, 12, -6, 5, -2, -7, 1, 13, -22, 11, 10, -1, 4, 0, -1, 
 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

* Although only slightly.

jscs

Posted 2011-04-23T15:29:42.797

Reputation: 900

1Python 3.5: q="qwertyuiopasdfghjklzxcvbnm";a=sorted(q);print(*a,q,"pyfgcrlaoeuidhtnsqjkxbmwvz",*a[::-1]) – Veedrac – 2016-03-23T08:22:31.843

15

PHP, 100 bytes

As ISO 8859-1:

<?=base64_encode("i·yø!9%z)ª»-ºü1Ë:°z»rº*)jÇ_ä<\½¹æ§'àr¹Z¡ë¢vg²¨äŹ°¿<òÇî¶Êê¦æHâÞuÆÚ");

To reproduce reliably,

printf '<?=base64_encode("' > 4times.php
printf abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba | base64 -d >> 4times.php
printf '");' > 4times.php

Ry-

Posted 2011-04-23T15:29:42.797

Reputation: 5 283

5That's an interesting way to do it. All of the other ones are variations on the same idea, but this one is a little different. – Peter Olson – 2011-04-23T20:05:10.390

I don't think this should count; the question is tagged "Kolmogorov complexity" and specifies "104 characters" which means we should be discriminating on what we consider a character. Otherwise I'll just define my own character encoding with a single character that maps to the ASCII for an entire program that solves the problem, and then decode that. – Adrian Petrescu – 2011-04-23T22:20:48.300

2@Adrian Petrescu: that's easily solved by requiring that the encoding already exist at the time the challenge is posed. – Lowjacker – 2011-04-23T22:52:08.787

@Lowjacker Sure, but that seems to be a pretty arbitrary way to resolve this. – Adrian Petrescu – 2011-04-23T23:09:13.130

@Adrian Petrescu: Go ahead. – Ry- – 2011-04-23T23:35:47.713

@Adrian It is somewhat arbitrary, but it is similar in spirit to this answer on meta: http://meta.codegolf.stackexchange.com/questions/9/what-programming-language-should-we-consider-for-the-code-golf-solution/10#10

– Peter Olson – 2011-04-24T00:31:24.827

5@Adrian, The advantage of unicode when using characters vs bytes has been acknowledged for a long time. In my opinion it doesn't make sense for the question to be tagged Kolmogorov while asking for characters. It should be counting bytes. It's up to the question asker to be careful about these terms. – gnibbler – 2011-04-24T22:04:10.047

10

Ruby 1.9, 88 87 84 80

puts b=[*?a..?z],:qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz,b.reverse

Lowjacker

Posted 2011-04-23T15:29:42.797

Reputation: 4 466

10

Bash, 82

echo {a..z}
echo qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz
echo {z..a}

Roger Spencer

Posted 2011-04-23T15:29:42.797

Reputation: 101

9

Bash, 72

echo {a..z} qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz {z..a}

EDIT: removed tr -d.

Credits: Alexander, Roger.

asoundmove

Posted 2011-04-23T15:29:42.797

Reputation: 358

2Rules allow you to omit |tr -d ' ', saving 10 characters and making this version a leader at the moment of writing :-) – Alexander Gladysh – 2011-04-24T00:04:10.043

@Alexander, Cool ;-) did not know that. Thanks to @Roger though for pointing me in the right direction. – asoundmove – 2011-04-24T05:07:49.003

I was trying to find a more elegant solution with some sort of polynomial with powers of primes and modulo (or in other words find a simple enough permutation function that works through that sequence)... but can't spend the sort of time required for such a solution, so I'll leave it at that. Plus it'd be pretty hard to express concisely. – asoundmove – 2011-04-24T05:59:39.690

9

Python, 97 96 "characters"

Taking your use of the word "characters" liberally, here's some python that uses 16-bit unicode characters to encode 3 normal characters each. The program is a total of 96 characters, 35 of which are the weirdest unicode characters I've ever seen.

for i in range(104):print chr((ord(u'ࠠᒃ⃦ⵉ��割廕��匓�เ᳅ⵉૹ�懬ࣅű傎ᱨ�⤰〷�弙劶��ⶍKᓇࡤ^A'[i/3])>>i%3*5&31)+97),

I'm not sure the unicode garbage will come though correctly, so here's a python program to generate the above python program:

#!/usr/bin/python                                                                                                                                                                 
import codecs
f=codecs.open('alpha.py','w','utf-8')
f.write('#!/usr/bin/python\n')
f.write('# coding=utf-8\n')
f.write('for i in range(104):print chr((ord(u\"')
S='''abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcbaa'''
for i in xrange(0,104,3):
 n=32*32*(ord(S[i+2])-97)+32*(ord(S[i+1])-97)+ord(S[i+0])-97
 f.write(u'%c'%n)
f.write('"[i/3])>>i%3*5&31)+97),\n')

Keith Randall

Posted 2011-04-23T15:29:42.797

Reputation: 19 865

9

Golfscript, 64 chars

"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz".$2%\1$-1%

Note: also 64 bytes. Actually, playing with Unicode and base changes seems counterproductive because base is too long a keyword.

Peter Taylor

Posted 2011-04-23T15:29:42.797

Reputation: 41 901

6

Windows PowerShell, 89

Not particularly good, but at least shorter than the output string:

[char[]](65..90)
'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'
[char[]](90..65))

Way shorter now that I saw that there is a relaxation on whitespace. And a little shorter still, if I ignore case which I'm allowed to.

Joey

Posted 2011-04-23T15:29:42.797

Reputation: 12 260

2You've got an extra ) there. Should be 88. – Iszi – 2013-12-13T17:48:34.077

5

Golfscript, 76, 67 chars

123,97>+."qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz"\-1%

YOU

Posted 2011-04-23T15:29:42.797

Reputation: 4 321

Use 123,97>+ to generate the initial alphabet. – Ventero – 2011-04-23T23:36:49.803

Thanks Ventero, I indeed saw that in your other post the other day. – YOU – 2011-04-24T06:14:30.693

4

CI - 92 chars

'a(1p'z((,0(4d)(.$)<)$)(0c0c.1+2p$.)>)$)qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz

CI ("Compiler/Interpreter") is a simple stack-based language I created for the "Self-Interpreting Interpreter" challenge (link to answer). I posted that answer about two hours before this challenge was posted. It's no GolfScript (which I still haven't gotten around to learning), as my goal was to make the interpreter short.

This program must be passed to the ci interpreter through standard input. The interpreter treats characters after a terminating ) as input to the program. My language doesn't support string literals, so stdin is taking its place.

Joey Adams

Posted 2011-04-23T15:29:42.797

Reputation: 9 929

3

Python 2.7.X - 103 characters ironically...

a='abcdefghijklmnopqrstuvwxyz'
print a,'qwertyuiopasdfghjklzxcvbnm pyfgcrlaoeuidhtnsqjkxbmwvz',a[::-1]

As it turns out, generating the alphabet in python takes more characters than hard-coding it. As does importing the alphabet. Gotta love a readability-centered language sometimes.

arrdem

Posted 2011-04-23T15:29:42.797

Reputation: 805

1You don't need the space between the QWERTY and DVORAK strings, it would be 1 character less. – Lowjacker – 2011-04-23T18:57:40.530

true, but python automatically appends a space between each item in the comma-separated printing list, so the space is my personal sacrifice to the alter of readable output. – arrdem – 2011-04-23T20:55:58.103

You could use the + instead of , and save that space. – Martin Ueding – 2011-04-23T22:21:51.110

3

C — 133 chars

Shortened version from Casey:

main(i){char a[105];strcpy(a+26,"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz");for(i=0;i<26;)a[i]=a[103-i]=i+++65;puts(a);}

Whitespaced:

main(i) {
    char a[105];
    strcpy(a+26, "qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz");
    for(i=0;i<26;)
        a[i]=a[103-i]=i+++65;
    puts(a);
}

Transposed output

Here is a version that does transposed output, for fun. 134 chars.

main(i){char*a="qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz";for(i=0;i<26;i++,a++)printf("%c%c%c%c\n",i+65,*a,*(a+25),90-i);}

Whitespaced:

main(i){
  char*a="qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz";
  for(i=0;i<26;i++,a++)
    printf("%c%c%c%c\n",i+65,*a,*(a+25),90-i);
}

Prints:

AqmZ
BwpY
CeyX
DrfW
EtgV
FycU
GurT
HilS
IoaR
JpoQ
KaeP
LsuO
MdiN
NfdM
OghL
PhtK
QjnJ
RksI
SlqH
TzjG
UxkF
VcxE
WvbD
XbmC
YnwB
ZmvA

Alexander Gladysh

Posted 2011-04-23T15:29:42.797

Reputation: 121

Still does not fit, of course. – Alexander Gladysh – 2011-04-23T23:24:59.033

1by declaring i as global and putting strcpy(...) to the first block of the for loop you get 129. still too much though. – bebe – 2014-07-11T21:20:37.473

3

J

x=:(97+/i.26){a.
x
261329910883437428257896643x A.x
247073478763191548160234722x A.x
(_1+/-i.26){x

My first experience with J. The idea is simply to use the canonical (lexicographic) number of the required permutation; unfortunately this takes more characters than hard-coding it. But if one could find some arithmetic expression (using powers and whatnot) yielding the magic numbers, it could be shortened.

Villemoes

Posted 2011-04-23T15:29:42.797

Reputation: 31

261329910883437428257896643 has the prime factorization 7601991213987797292923318887 so there are no powers in this one. – Jerry Jeremiah – 2016-03-23T21:35:00.823

3

Python, 90 unicode chars

#coding:u8
print u"扡摣晥桧橩汫湭灯牱瑳癵硷穹睱牥祴極灯獡晤桧歪穬捸扶浮祰杦牣慬敯極桤湴煳歪扸睭究祺睸當獴煲潰浮歬楪杨敦捤慢".encode("u16")[2:]

run at ideone - http://ideone.com/R2dlI or codepad - http://codepad.org/lp77NL9w

YOU

Posted 2011-04-23T15:29:42.797

Reputation: 4 321

2Actually, it only has 52 "characters". – Peter Olson – 2011-04-24T15:21:17.287

3

Javascript 139 121

new:

q='qwertyuiopasdfghjklzxcvbnm'
a=q.split('').sort()
alert(a.join('')+q+'pyfgcrlaoeuidhtnsqjkxbmwvz'+a.reverse().join(''))

old:

a=[]
a[26]='qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'
for(i=0;i<26;i++)a[i]=a[52-i]=String.fromCharCode(i+65)
alert(a.join(''))

Neil McGuigan

Posted 2011-04-23T15:29:42.797

Reputation: 131

You could also have 121 with: alert((a=(q='qwertyuiopasdfghjklzxcvbnm').split('').sort()).join('')+q+'pyfgcrlaoeuidhtnsqjkxbmwvz'+a.reverse().join('')) – WallyWest – 2013-12-17T05:06:08.767

2

05AB1E, 25 bytes

AžW.•8t”a$äJÚ₁вƒüu¯Cê•AR»

Try it online!

Explanation

A                          # Push alphabet                    
 žW                        # Push qwerty string
   .•8t”a$äJÚ₁вƒüu¯Cê•     # Push compressed dvorak string
                      AR   # Push reversed alphabet
                         » # Join entire stack with newlines

Wisław

Posted 2011-04-23T15:29:42.797

Reputation: 554

2

C - 163 135 chars

This doesn't meet the requirements as it clocks in at over 104 characters, but it was fun to make. Maybe someone will have some suggestions.

main(i){char a[105];strcpy(&a[26],"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz");for(i=0;i<26;)a[i]=a[103-i]=i+++65;puts(a);}

This compiles on GCC 4.5.1 (others untested). Yay for omitting #includes, return types, and variable declarations! Hardcoding would've resulted in a shorter program, but that isn't any fun.

Whitespaced version:

main(i) {                                                                                   
    char a[105];                                                                        
    strcpy(&a[26], "qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz");                 
    for(i=0;i<26;)                                                                          
        a[i]=a[103-i]=i+++65;                                                               
    puts(a);                                                                                
}

C - 124 122 lame

Here is the lame hardcoded version, and it still doesn't make the cut.

main(){puts("abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba");}

Casey

Posted 2011-04-23T15:29:42.797

Reputation: 3 129

Use puts() instead printf in second case — 2 chars less. – Alexander Gladysh – 2011-04-23T23:11:19.497

And replace while with puts(a); in first case, dropping *p=a; — 138 chars instead of 163. – Alexander Gladysh – 2011-04-23T23:13:09.540

Awesome suggestions! I had totally forgotten about puts. Changed. – Casey – 2011-04-24T00:28:35.123

2

Lua — 111 characters

Beats C and C++! :-)

print'abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba'

"Clever" version in Lua

129 characters

q='qwertyuiopasdfghjklzxcvbnm'a={q:byte(1,-1)}table.sort(a)a=q.char(unpack(a))print(a,q,'pyfgcrlaoeuidhtnsqjkxbmwvz',a:reverse())

Whitespaced:

q='qwertyuiopasdfghjklzxcvbnm'
a={q:byte(1,-1)}
table.sort(a)
a=q.char(unpack(a))
print(a,q,'pyfgcrlaoeuidhtnsqjkxbmwvz',a:reverse())

Alexander Gladysh

Posted 2011-04-23T15:29:42.797

Reputation: 121

2

J - 69 char

'pyfgcrlaoeuidhtnsqjkxbmwvz'(,~|.)&(,\:~)'mnbvcxzlkjhgfdsapoiuytrewq'

Explanation:

  • (,\:~) y - Sort y in descending order (\:~), and append (,) that to y.

  • x (,~|.) y - Reverse (|.) y, and append that to the front of x.

  • x F&G y - Execute (G y) F (G y), that is, perform F on the results of applying G to the arguments.

So, all together, we append the alphabet, backwards, to both the Dvorak and reverse-QWERTY strings, then reverse the QWERTY/alphabet one and put that in front of the Dvorak/alphabet one.

algorithmshark

Posted 2011-04-23T15:29:42.797

Reputation: 8 144

2

PHP 88 bytes

<?=$a=join(range(a,z)),~Žˆš‹†Š–žŒ›™˜—•”“…‡œ‰‘’†™˜œ“žšŠ–›—‹‘ŒŽ•”‡’ˆ‰…,strrev($a);

echofish

Posted 2011-04-23T15:29:42.797

Reputation: 21

2

Bash, 64

I'm very late to the party, but I have a 64 character solution. Program needs to be saved to disk to work

echo {a..z} $(sed 1d $0|base64) {z..a};exit
««·+¢¢–¬uø!ŽIsÅËÛžjr~+•ªº'a¶{*ŽL[›ó

How it works:

{a..z} and {z..a} are pretty self explanatory, but basically that just prints every character in that respective range.

$(sed 1d $0|base64) outputs the program, ignores the first line, then passes it through a base64 encoder (as some other examples have done).

The reason this is shorter than other similar examples...

...is because the {a..z} ranges are shorter than base64 encodings, so I only need to base64 encode half the string. And because I'm reading the binary data from file rather than storing it in a string, I don't need to escape any character in code.

How to recreate this script:

If the code doesn't copy/paste correctly from Stack Exchange to your text editor then run the following in your command line (shell agnostic):

echo 'echo {a..z} $(sed 1d $0|base64) {z..a};exit' > alphabetgolf
echo 'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz' | base64 -d >> alphabetgolf

Then to run:

bash alphabetgolf

Laurence

Posted 2011-04-23T15:29:42.797

Reputation: 31

1

Deorst, 39 bytes

EfEuE|'pyfgcrlaoeuidhtnsqjkxbmwvz'EfVE;

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

caird coinheringaahing

Posted 2011-04-23T15:29:42.797

Reputation: 13 702

1

C++

It's kind of sad when the shortest way to do something in a language is to hard-code it.

#include <iostream>

int main()
{
 std::cout<<"abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba";
}

John

Posted 2011-04-23T15:29:42.797

Reputation: 251

You could put the {} and the code in one line. – Mega Man – 2016-06-28T18:16:33.617

You don't need to output the linefeeds. – Lowjacker – 2011-04-23T20:21:06.947

@Low: Doh! I forgot to remove those when I took out the line breaks I realized I didn't need. Thanks for pointing that out. – John – 2011-04-23T20:23:22.527

This is a very obvious solution, and it surpasses the maximum length requirement. – Peter Olson – 2011-04-24T00:35:04.277

std::cout is shorter that using namespace std, and you can skip void. – Alexander Gladysh – 2011-04-24T00:42:05.317

@Alex: Thanks for pointing that out. – John – 2011-04-24T02:18:54.480

1

J (77)

(,|.@(26&{.))(,~/:~@(26&{.))'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'

Shaved off 3 characters by using a variable:

(,|.@a)(,~/:~@(a=.26&{.))'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'

Shaved off 2 more characters by using a value-level approach:

(|.a),~t,~a=./:~26{.t=.'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'

Gregory Higley

Posted 2011-04-23T15:29:42.797

Reputation: 395

1

Haskell (95)

main=putStr$['a'..'z']++"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz"++['z','y'..'a']

Perl (51)

There's no rule that says I can't.

use LWP::Simple;print get("http://bit.ly/fGkflf");

marinus

Posted 2011-04-23T15:29:42.797

Reputation: 30 224

1

See the list of standard loopholes.

– boboquack – 2016-10-25T23:05:00.133

1

K - 69 char

b,a,|b:a@<26#a:"qwertyuiopasdfghjklzxcvbnmpyfgcrlaeouidhtnsqjkxbmwvz"

Explanation:

  • 26#a: - Assign the two keyboard layouts to a, and then take the first 26 characters.

  • b:a@< - Sort a and assign that to b: < provides the permutation for an ascending sort, and @ lets us index a in order to sort it.

  • b,a,| - Append in a row b, then a, then the reverse (|) of b.

algorithmshark

Posted 2011-04-23T15:29:42.797

Reputation: 8 144

1

Pyth, 57

G"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz"VG

Alphabet, string, reversed alphabet. G is the alphabet. Print is implicit.

isaacg

Posted 2011-04-23T15:29:42.797

Reputation: 39 268

1

Q (68)

.Q.a,"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz",(|:).Q.a

Outputs:

"abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfg     
crlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba"

Tried to find an improvement on hard-coding the middle two but didn't come up with one.

sinedcm

Posted 2011-04-23T15:29:42.797

Reputation: 410

1

Dyalog APL, 60 bytes

⎕A'QWERTYUIOPASDFGHJKLZXCVBNMPYFGCRLAOEUIDHTNSQJKXBMWVZ',⌽⎕A

Prints:

  ABCDEFGHIJKLMNOPQRSTUVWXYZ  QWERTYUIOPASDFGHJKLZXCVBNMPYFGCRLAOEUIDHTNSQJKXBMWVZ ZYXWVUTSRQPONMLKJIHGFEDCBA

Which is permitted as per OP:

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

Adám

Posted 2011-04-23T15:29:42.797

Reputation: 37 779

1

Jelly, 36 bytes (non-competing)

Øa;Øq;“pyfgcrlaoeuidhtnsqjkxbmwvz”;U

Try it online!

Explanation:

Øa;Øq;“pyfgcrlaoeuidhtnsqjkxbmwvz”;U    |
Øa;                                     | alphabet
   Øq;                                  | list with all rows of the qwerty keyboard
      “pyfgcrlaoeuidhtnsqjkxbmwvz”;     | string
                                   U    | reverse

acrolith

Posted 2011-04-23T15:29:42.797

Reputation: 3 728

1

05AB1E, 60 59 bytes

AÂ"qwertyuiopasdfghjklzxcvbnm""pyfgcrlaoeuidhtnsqjkxbmwvz"»

Try it online!

- pushes the bifurcated alphabet.

"qwertyuiopasdfghjklzxcvbnm""pyfgcrlaoeuidhtnsqjkxbmwvz" - Pushes qwerty and drovak.

» - Prints stack.

05AB1E, 57 bytes (If you don't care about random \n)

AÂ"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz"»

Try it online!

Magic Octopus Urn

Posted 2011-04-23T15:29:42.797

Reputation: 19 422

In the first example, you can save a byte by replacing "" with a newline. – Neil A. – 2017-05-22T00:26:10.797

0

Jelly, 25 bytes

Øa;Øq;“¡®×Ṫ}Ƭ#Q>Ẉṛ’œ?$;Ṛ

Try it online!

Erik the Outgolfer

Posted 2011-04-23T15:29:42.797

Reputation: 38 134

0

PHP - 45

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

<?=file_get_contents("http://goo.gl/dK17k");

Nicklas Ansman

Posted 2011-04-23T15:29:42.797

Reputation: 117

Only solution of its kind! :D +1 – Ry- – 2011-04-27T04:31:30.897

@minitech: I posted a similar solution in Python, longer but with more correct output, before this.

– jscs – 2011-04-27T20:16:24.510

Okay, upvoted also. But this is shorter. Also not sure how you can have "more" correct output (it is correct). – Ry- – 2011-04-27T21:00:50.253

@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! :) – jscs – 2011-04-28T21:01:24.263

@minitech: my mistake; I assumed this was pointing to this page. Apologies to you and to Nicklas. – jscs – 2011-04-28T22:43:41.577

0

Bash, 109

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

Output:

abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba

John B

Posted 2011-04-23T15:29:42.797

Reputation: 109

0

Mouse-2002, 99 bytes

65i:(i.h.<^i.!'i.1+i:)"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz"(i.64>^i.!'i.1-i:)

Self-explanatory.

cat

Posted 2011-04-23T15:29:42.797

Reputation: 4 989

0

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!

ATaco

Posted 2011-04-23T15:29:42.797

Reputation: 7 898

0

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")

Trevor Sibanda

Posted 2011-04-23T15:29:42.797

Reputation: 31