# Generate alphabet with 4 copies of each letter

Note that this is not the same as Print the alphabet four times.

This task is to write a program to generate four copies of each letter of the English alphabet, one letter per line, on standard output:

A
A
A
A
B
B
B
B


etc.

The output should include newlines after each letter.

Uppercase letters with no extra output are preferred; however, lowercase letters and/or extra whitespace are acceptable if capitalizing/stripping would lengthen your solution.

EDITED TO ADD: The solution must be complete enough to execute. I should be able to invoke an implementation of the language, paste the code from the answer, and get results, without typing any additional code.

The above question of completeness came up in the context of a C solution. Surely there must be a standing rule or convention about this on a code golfing site? If so, I'll gladly yield to the community guidelines. But this is my take:

1. With regard to C specifically, you need to include (and count) the main(){...} around the code, since it won't compile otherwise. Warnings because there's no #include <stdio.h> are fine as long as the code still compiles. In general, a compiled language requires a compilable unit.

2. A bare expression that yields the desired results is acceptable if there's a way to execute the expression directly; for instance, if the language has a REPL. So you can submit Haskell without a main= as long as it actually works as written at e.g. the ghci prompt. But since that means putting let on your declarations, it may be a net win to stick with the runhaskell format.

3. Similarly, awk scripts should be in BEGIN (or END, with the assumption that stdin is attached to /dev/null) blocks since we're not processing any input.

etc.

• I'm slightly confused. Is the challenge here just to output the alphabet with each letter repeated four times, or does the output actually need to be stored in a file as well? – Iszi Dec 13 '13 at 17:26
• And do I have to output only the alphabet? – Justin Dec 13 '13 at 17:33
• @MarkReed Do I need to print it with newlines in between? Why not just print it, but newlines optional? – Justin Dec 13 '13 at 17:44
• Also, I recommend rephrasing your challenge so that it is more like a challenge and less like telling the story of how you invented your answer. – Justin Dec 13 '13 at 17:46
• The last bit muddies the whitespace rules just a tad. Could you please clarify? Particularly, am I reading it right to interpret that extra whitespace is okay but omission of newlines is not? – Iszi Dec 13 '13 at 19:44

# Funky, 32 bytes

fori=0i<104i++print("%c"%65+i/4)


Try it online!

# Pyth - 7 Bytes

VrG1V4N


Explanation

VrG1V4N
V       For each character N in
G     The alphabet
r 1    Converted to uppercase:
V4  For each variable from 0 to 3:
N Implicitly print N


# F# (.NET Core), 43 bytes

for i in 260..363 do printfn"%c"(char(i/4))


Try it online!

L,91 65rbU€C4€*JbUn


Try it online!

## How it works

L,			; Create an anonymous function
91 65rbU	; Push [65 ... 90]	STACK = [65 66 ... 89 90]
€C		; Convert to chars;	STACK = ['A' 'B' ... 'Y' 'Z']
4€*		; Repeat each 4 times;	STACK = ['AAAA' ... 'ZZZZ']
JbUn		; Join by newlines;	STACK = ['A\nA\n ... Z\nZ']


# Jelly, 5 bytes

ØAx4Y


Try it online!

# Python 2.7, 78 bytes

x='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for e in x:
for d in range(0, 4):
print e

• Golfing challenge submissions have to make an attempt at golfing. In your code there is unnecessary white space, the variable x is declared once so could be inlined and the last for loop's body is not a compound statement so could be put on the same line. I also suggest reading the Python tips page. – Jonathan Frech Jul 9 '18 at 20:09

# Attache, 28 bytes

Print@Char=>Flat!4&&=>65:90


Try it online!

# K (oK), 17 16 bytes

Solution:

0:c$+,65+&26#4  Try it online! Explanation: 0:c$+,65+&26#4 / the solution
26#4 / generate a vector of 26 4s
&     / where, turns this into 0 0 0 0 1 1 1 1 2 2 2 2 etc
65+      / add 65 to this vector
,         / enlist (,:) each-both (')
+          / flip
c$/ convert to characters 0: / print to stdout  Notes: • -1 byte with thanks to @ngn! • ,:' -> +,­­ – ngn Jan 27 '19 at 15:40 # @NUM, 43 bytes #1@13#0@65|#1$#0$#1$#0$#1$#0$#1$#0$+<90{*0}  (I messed up on some of the code, now it works, but is almost double the size...) • Welcome to PPCG! Languages are required to have an implementation (interpreter/compiler), so you'll need to either link to one or write one. – lirtosiast Jan 29 '19 at 2:41 • I would call your language implementation an interpreter. Also, I am unsure if a leading newline is valid. Furthermore, I would recommend not to send the execution time to stdout. – Jonathan Frech Jan 29 '19 at 8:01 # Charcoal, 6 bytes Ｆα↓×⁴ι  Explanation: Loop over the characters of the uppercase alphabet: For(a) Ｆα  Repeat the current letter 4 times, and print it in a downward direction: Print(:Down, Times(4, i)); ↓×⁴ι  • Hm, that's 6 characters, but I don't see how you can encode them into 6 bytes. I would change the title to just claim "6" instead of "6 bytes". Sadly, 6 characters is still one more than APL. – Mark Reed Jan 29 '19 at 17:01 • @MarkReed In UTF-8 this would indeed be a bit more than 6 bytes (15 to be exact). However, Charcoal uses, just like most codegolf languages (i.e. Jelly, 05AB1E, etc.), a custom code page for all 256 characters it knows, where each character is encoded as a single byte. – Kevin Cruijssen Jan 29 '19 at 17:07 • Ah, my mistake. Didn't realize it was limited to a single code page. Carry on. :) – Mark Reed Jan 30 '19 at 4:49 BRAINF 115 BYTES... ++++[->+++>+++>+++<<<]>+>+>+<<<++++[->>+++>+++<<<]>>+>+<<<+++++++++++++[->>>+++<<<]>>[->.<<.>>.<<.>>.<<.>>.<<.>>+<]  I know this isn't going to in any awards for being the smallest, but I just thought it would be funny to use one of the hardest to understand languages. Breakdown of Code Cell zero is used for counting for setup, cell 1 and 3 are used to print, and cell two is used to count for the printing sequence 0 1 2 3 [setup][newline char][print counter][output char (set to A to begin)] ++++[->+++>+++>+++<<<]>+>+>+ sets cells 1, 2, and 3 to 13(new line) <<<++++[->>+++>+++<<<]>>+>+ sets cells 2 and 3 to 26 (length of alphabet) <<<+++++++++++++[->>>+++<<<] sets cell 3 to 65(A) >>[->.<<.>>.<<.>>.<<.>>.<<.>>+<] increments cell 3, prints alternating between cell 1 and 3, and decrements cell 2.  Here is a Brainf compiler to test it (use the one w/out any newlines) • Is it so hard to just say brainfuck? At the very least brainf*ck if you're that uncomfortable with swearing. Saying BRAINF just makes everyone confused about what you're referring to – Jo King Jan 31 '19 at 11:54 • also, the triple exclamation mark is a bit too excitable for almost twice the bytecount of the previous brainfuck answer – Jo King Jan 31 '19 at 12:07 • @JoKing I wrote this before i realized that there was another Brainfuck program, sorry about that, i never got to fixing it – KrystosTheOverlord Jan 31 '19 at 12:09 • having a longer answer is okay, especially in a language like brainfuck. the tips for golfing in brainfuck page might interest you for future submissions – Jo King Jan 31 '19 at 12:18 # Cardinal, 68 bytes %+v (A+ ~ = ([t ' >t*~v 8 v~'n< D<v< # -~ ~+, ,, ,,~ ,,- ,~ >^R^  Try it online! ## Explanation %+v (A+ ~ = ([t ' >t*~v 8 v~'n< **** #  Sets up loops for printing and corrects timing between loops. Right column sets up space to be printed in a loop of 25 times while left column sets up letters of alphabet starting with A to be printed. D<v< -~ ~+, ,, ,,~ ,,- ,~ >^R^  Left 2 columns print out each letter in alphabet while right 2 columns print out newlines. ### How the loops work: The inactive value of the pointer is set to the number of times to iterate through the loop. The timing of the loops is set up so that it will print alphabet character then newline four times before decrementing the inactive value of the pointer. The alphabet character to print was selected at the start by assigning the ascii value of A to the active value of the pointer "(A" in the code. After each loop of printing, this active value is incremented by one to print the next character in the alphabet. ## Keg, 20 bytes (SBCS on Keg wiki) AZɧ^(\ (3|$:\
)\$(8|,


Push range from A to Z and then 4-speak it.

# Q, 16

........

-1@'(,/)4#'.Q.A;


### 4DOS, 59 (including newlines)

Why? Because not enough people use it any more and it's still the same size as C and shorter than F#!

do i=65 to 90
@for %j in (1 2 3 4) do echo %@CHAR[%i]
enddo


### Bash 28 26

echo {a..z}{,,,}|tr \  \\n

• A shame bash doesn't do curly-brace expansion on here-strings. – Mark Reed Dec 15 '13 at 4:40

# ///, 207 bytes

A
A
A
A
B
B
B
B
C
C
C
C
D
D
D
D
E
E
E
E
F
F
F
F
G
G
G
G
H
H
H
H
I
I
I
I
J
J
J
J
K
K
K
K
L
L
L
L
M
M
M
M
N
N
N
N
O
O
O
O
P
P
P
P
Q
Q
Q
Q
R
R
R
R
S
S
S
S
T
T
T
T
U
U
U
U
V
V
V
V
W
W
W
W
X
X
X
X
Y
Y
Y
Y
Z
Z
Z
Z


# dc, 23 bytes

260[d4/PAP1+d364>M]dsMx


Try it online!

Since precision is 0 by default, 260, 261, 262, and 263 all return 65 when divided by 4. All we need to do, then, is start with 260 on the stack, and continue duplicating the top of stack, dividing by 4, printing that code point and a line feed and then incrementing by one until we hit 364 (91*4).

# SOGL V0.12, 5 bytes

Z{4⌡T


Try it Here!

# Taxi, 1215 449 bytes

(I am calling this the Magna Carta byte count)

It turns out to be way shorter to just hard code the text.

'A\nA\nA\nA\nB\nB\nB\nB\nC\nC\nC\nC\nD\nD\nD\nD\nE\nE\nE\nE\nF\nF\nF\nF\nG\nG\nG\nG\nH\nH\nH\nH\nI\nI\nI\nI\nJ\nJ\nJ\nJ\nK\nK\nK\nK\nL\nL\nL\nL\nM\nM\nM\nM\nN\nN\nN\nN\nO\nO\nO\nO\nP\nP\nP\nP\nQ\nQ\nQ\nQ\nR\nR\nR\nR\nS\nS\nS\nS\nT\nT\nT\nT\nU\nU\nU\nU\nV\nV\nV\nV\nW\nW\nW\nW\nX\nX\nX\nX\nY\nY\nY\nY\nZ\nZ\nZ\nZ' is waiting at Writer's Depot.Go to Writer's Depot:w 1 r 3 l 2 l.Pickup a passenger going to Post Office.Go to Post Office:n 1 r 2 r 1 l.


Ungolfed / formatted:

'A\nA\nA\nA\nB\nB\nB\nB\nC\nC\nC\nC\nD\nD\nD\nD\nE\nE\nE\nE\nF\nF\nF\nF\nG\nG\nG\nG\nH\nH\nH\nH\nI\nI\nI\nI\nJ\nJ\nJ\nJ\nK\nK\nK\nK\nL\nL\nL\nL\nM\nM\nM\nM\nN\nN\nN\nN\nO\nO\nO\nO\nP\nP\nP\nP\nQ\nQ\nQ\nQ\nR\nR\nR\nR\nS\nS\nS\nS\nT\nT\nT\nT\nU\nU\nU\nU\nV\nV\nV\nV\nW\nW\nW\nW\nX\nX\nX\nX\nY\nY\nY\nY\nZ\nZ\nZ\nZ' is waiting at Writer's Depot.
Go to Writer's Depot: west 1st right 3rd left 2nd left.
Pickup a passenger going to Post Office.
Go to Post Office: north 1st right 2nd right 1st left.


# Tcl, 51 bytes

time {puts [format %c [expr (259+[incr i])/4]]} 104


Try it online!

# Python 2, 39 bytes

i=65;exec('print chr(i);'*4+'i+=1;')*26


Try it online!

# cQuents, 18 bytes

|
#104&h64+k,Z,Z,Z


Try it online!

# Explanation

|
use newline as delimiter
#104              default input n = 104
&             print first n terms in sequence
each term is the next term in the comma-delimited sequence, restarting
and incrementing k when the end of the terms list is reached
h64+k        chr ( 64 + k )
,Z,Z,Z  next three terms equal the previous term


## 05AB1E, 6 bytes

A€D€D»


Try it online!

### Explanation

A        # push lowercase alphabet
€       # for each char:
D      # duplicate it
€D    # duplicate each char again
»   # join by newlines
# implicit output


# Brian & Chuck, 32 bytes

A{<?
!{>-_{.>.<.>.<.>.<.+>.>-?


Try it online!

code:

Brian:
A                       ["A", 11, 26] Variables: Letter, newline+1, letter count
{<?                        restart current code portion of Chuck

Chuck:
code 1:
{>-                        go to "newline+1" and decrement it, so it becomes a newline

code 2:
{                          go to letter
.>.<.>.<.>.<               print letter and newline three times
.+                         print and increment letter
>.                         print 4th newline
>-                         decrement counter
?                          if counter > 0, switch to Brian (who just restarts Chuck's code 2)


# GolfScript, 17 bytes

91,65>''+{...}%n*


Try it online!

# Explanation

91,65>            # Genearate initial alphabet
''+         # Convert to a string
{...}%   # For every item, copy 3 times
n* # Join the resulting string by newlines
# (because a string is a codepoint array)
`