Confusing Alphabet Staircase

25

3

Given no input, output this interesting alphabet pattern in either case (the case has to be consistent) via an accepted output method:

A
AB
ACBC
ADBDCD
AEBECEDE
AFBFCFDFEF
AGBGCGDGEGFG
AHBHCHDHEHFHGH
AIBICIDIEIFIGIHI
AJBJCJDJEJFJGJHJIJ
AKBKCKDKEKFKGKHKIKJK
ALBLCLDLELFLGLHLILJLKL
AMBMCMDMEMFMGMHMIMJMKMLM
ANBNCNDNENFNGNHNINJNKNLNMN
AOBOCODOEOFOGOHOIOJOKOLOMONO
APBPCPDPEPFPGPHPIPJPKPLPMPNPOP
AQBQCQDQEQFQGQHQIQJQKQLQMQNQOQPQ
ARBRCRDRERFRGRHRIRJRKRLRMRNRORPRQR
ASBSCSDSESFSGSHSISJSKSLSMSNSOSPSQSRS
ATBTCTDTETFTGTHTITJTKTLTMTNTOTPTQTRTST
AUBUCUDUEUFUGUHUIUJUKULUMUNUOUPUQURUSUTU
AVBVCVDVEVFVGVHVIVJVKVLVMVNVOVPVQVRVSVTVUV
AWBWCWDWEWFWGWHWIWJWKWLWMWNWOWPWQWRWSWTWUWVW
AXBXCXDXEXFXGXHXIXJXKXLXMXNXOXPXQXRXSXTXUXVXWX
AYBYCYDYEYFYGYHYIYJYKYLYMYNYOYPYQYRYSYTYUYVYWYXY
AZBZCZDZEZFZGZHZIZJZKZLZMZNZOZPZQZRZSZTZUZVZWZXZYZ

Trailing spaces and newlines are acceptable, standard loopholes are disallowed, and this happens to be , so the shortest answer in bytes wins!

FantaC

Posted 2018-01-13T23:14:37.860

Reputation: 1 425

Related, Related – FantaC – 2018-01-13T23:18:07.900

BTW if I see an amazing answer I will bounty it 50 rep – FantaC – 2018-01-13T23:26:12.487

13The leading A really messes things up for me... – ETHproductions – 2018-01-13T23:38:39.313

Why the downvote? Can I improve anything? – FantaC – 2018-01-14T00:05:45.917

2Some people simply don't like these kind of challenges I think. – Jonathan Allan – 2018-01-14T00:10:42.020

1@ETHproductions It simplifies things for me! – Neil – 2018-01-14T00:17:09.637

Can it be lowercase? – l4m2 – 2018-04-12T08:50:30.343

@l4m2 Sure thing – FantaC – 2018-04-12T15:15:56.690

Answers

5

Canvas, 7 bytes

Z[K*¹+]

Try it here!

Explanation:

Z[     ] for each prefix of the uppercase alphabet
    K        pop off the last letter
     *       and join the rest of the string with that character
      ¹+     and append the current iterated character to it

dzaima

Posted 2018-01-13T23:14:37.860

Reputation: 19 048

Why didn't you edit your previous answer? – Neil – 2018-01-17T10:03:10.653

@Neil good question. Not sure – dzaima – 2018-01-17T10:12:28.127

Accepted! You beat Jelly and Charcoal by two bytes! – FantaC – 2018-02-09T15:48:50.660

8

Jelly, 9 bytes

ØAjṪ$Ƥż¹Y

Try it online!

How it works

ØAjṪ$Ƥż¹Y  Main link. No arguments.

ØA         Yield "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
     Ƥ     Map the link to the left over all prefixes, i.e., ["A", "AB", ...].
    $        Combine the two links to the left into a chain.
   Ṫ           Tail; yield and remove the last letter of each prefix.
  j            Join the remainder, using that letter as separator.
      ż¹   Zip the resulting strings and the letters of the alphabet.
        Y  Separate the results by linefeeds.

Dennis

Posted 2018-01-13T23:14:37.860

Reputation: 196 637

2Oh, haha and I was just about to post ØAjṪ$ƤżØAY :D – Jonathan Allan – 2018-01-13T23:43:25.543

7

C, 82 bytes

f(i,j){for(i=!puts("A");++i<26;puts(""))for(j=0;j++<i*2;)putchar(65+(j&1?j/2:i));}

Try it online!

Steadybox

Posted 2018-01-13T23:14:37.860

Reputation: 15 798

6

R, 50 bytes

l=LETTERS
for(i in 0:25)cat(l[0:i],"
",sep=l[i+1])

Try it online!

Perhaps the cleverest part here is using letters[0] for the empty string to get cat(character(0),'\n',sep="A") to print the first line.

Giuseppe

Posted 2018-01-13T23:14:37.860

Reputation: 21 077

6

Charcoal, 9 bytes

Eα⁺⪫…ακιι

Try it online! Link is to verbose version of code. Explanation:

 α          Predefined uppercase alphabet
E           Map over each character
    …ακ     Get current prefix of alphabet
   ⪫   ι    Join with current character
  ⁺     ι   Append current character
            Implicitly print on separate lines

Neil

Posted 2018-01-13T23:14:37.860

Reputation: 95 035

5

Python 2, 56 bytes

n=65;s='';exec'c=chr(n);print c.join(s)+c;s+=c;n+=1;'*26

Try it online!

Dennis

Posted 2018-01-13T23:14:37.860

Reputation: 196 637

4

6502 machine code routine (C64), 39 bytes

A9 41 20 D2 FF AA A8 84 FB E4 FB B0 0B 8A 20 D2 FF 98 20 D2 FF E8 D0 F1 A9 0D
20 D2 FF A2 41 C0 5A F0 03 C8 D0 E1 60

Position-independet machine code subroutine, clobbers A, X and Y.

Online demo

The demo loads at $C000, so use SYS49152 to call the routine.


Commented disassembly:

A9 41       LDA #$41            ; 'A'
20 D2 FF    JSR $FFD2           ; Kernal CHROUT (output character)
AA          TAX                 ; copy to X (current pos)
A8          TAY                 ; copy to Y (current endpos)
  .outerloop:
84 FB       STY $FB             ; endpos to temporary
  .innerloop:
E4 FB       CPX $FB             ; compare pos with endpos
B0 0B       BCS .eol            ; reached -> do end of line
8A          TXA                 ; current pos to accu
20 D2 FF    JSR $FFD2           ; and output
98          TYA                 ; endpos to accu
20 D2 FF    JSR $FFD2           ; and output
E8          INX                 ; next character
D0 F1       BNE .innerloop      ; (repeat)
  .eol:
A9 0D       LDA #$0D            ; load newline
20 D2 FF    JSR $FFD2           ; and output
A2 41       LDX #$41            ; re-init current pos to 'A'
C0 5A       CPY #$5A            ; test endpos to 'Z'
F0 03       BEQ .done           ; done when 'Z' reached
C8          INY                 ; next endpos
D0 E1       BNE .outerloop      ; (repeat)
  .done:
60          RTS

Felix Palmen

Posted 2018-01-13T23:14:37.860

Reputation: 3 866

3

SNOBOL4 (CSNOBOL4), 169 143 bytes

i &ucase len(x) . r len(1) . s
 o =
 i =
t r len(i) len(1) . k :f(o)
 o =o s k
 i =i + 1 :(t)
o o s =
 output =o s
 x =lt(x,25) x + 1 :s(i)
end

Try it online!

i &ucase len(x) . r len(1) . s	;* set r to the first x characters and s to the x+1th.
 o =				;* set o,i to empty string
 i =
t r len(i) len(1) . k :f(o)	;* set k to the ith letter of r. on failure (no match), go to o.
 o =o s k			;* concatenate o,s,k
 i =i + 1 :(t)			;* increment i, goto t
o o s =				;* remove the first occurrence of s (the first character for x>1, and nothing otherwise)
 output =o s			;* output o concatenated with s
 x =lt(x,25) x + 1 :s(i)	;* increment x, goto i if x<25.
end

The problem here is the first line

using o s k will add an extra separator character at the beginning of each line and also not have an s at the end. This is OK because line t will jump over the following two lines when x=0. This means that o will still be blank. Hence, o s = will remove the first s character from o, and then we can simply print o s to have the appropriate last s.

Giuseppe

Posted 2018-01-13T23:14:37.860

Reputation: 21 077

3

Java 8, 93 91 90 bytes

v->{String t="";for(char c=64;++c<91;t+=c)System.out.println(t.join(c+"",t.split(""))+c);}

-1 byte thanks to @OlivierGrégoire by printing directly instead of returning

Explanation:

Try it online.

v->{                     // Method with empty unused parameter and String return-type
  String t="";           //  Temp-String, starting empty
  for(char c=64;++c<91;  //  Loop over the letters of the alphabet:
      t+=c)              //    After every iteration: append the letter to the temp-String
    System.out.println(  //   Print with trailing new-line:
       r.join(c+"",t.split(""))
                         //    The temp-String with the current letter as delimiter
       +c);}             //    + the current letter as trailing character 

Kevin Cruijssen

Posted 2018-01-13T23:14:37.860

Reputation: 67 575

290 bytes (just using stdout instead of returning). – Olivier Grégoire – 2018-01-15T12:19:11.737

Nice answer! I ported to C# to see if it was shorter and I get 91 (more if I include System.) :) – aloisdg moving to codidact.com – 2018-01-15T13:04:26.477

2

Japt (-R flag), 14 12 bytes

-2 bytes thanks to @Shaggy

;B¬
ËiU¯E qD

Test it online!

ETHproductions

Posted 2018-01-13T23:14:37.860

Reputation: 47 880

If only there were a shortcut for s0,! ;p – Shaggy – 2018-01-14T00:31:37.313

12 bytes. But why aren't you counting the -R here? – Shaggy – 2018-01-14T00:37:05.667

@Shaggy Oh wow, I knew I was missing something :P The i trick is great, thanks! As for the flag, there appears to be a new consensus that each unique invocation of a program should be considered a separate language. (which makes Japt's flag system seem kind of cheaty...)

– ETHproductions – 2018-01-14T01:37:49.357

2

Haskell, 49 48 bytes

'A':unlines[init['A'..x]>>=(:[x])|x<-['A'..'Z']]

Try it online!

Edit: -1 byte thanks to totallyhuman!

Laikoni

Posted 2018-01-13T23:14:37.860

Reputation: 23 676

2

JavaScript (ES6), 81 bytes

f=
_=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"].map((c,i,a)=>a.slice(0,i).join(c)+c).join`
`
;document.write('<pre>'+f());

Save 9 bytes if a string array return value is acceptable.

Neil

Posted 2018-01-13T23:14:37.860

Reputation: 95 035

2

><>, 44 34 bytes

"BA"oao"ZA"\=?;1+40.
o1+:{::o}=?\:

Try it online!

><>, 44 bytes

"A"o10ao\55*=?;1+40.
1+:{:}=?\:"A"+o{:}"A"+o

Try it online!

As I use a different route to producing the output I've posted my own ><> answer; The other ><> answer can be found here.

Big thanks to Jo king for spotting I didn't need to keep putting "A" onto the stack if I just compared against "Z" instead of 26. (-10 bytes)

Explanation

The explanation will follow the flow of the code.

"BA"                 : Push "BA" onto the stack;
                       [] -> [66, 65]
    oao              : Print the stack top then print a new line;
                       [66, 65] -> [66]
       "ZA"\         : Push "ZA" onto the stack then move down to line 2;
                       [66, 90, 65]
o          \:        : Duplicate the stack top then print
 1+:                 : Add one to the stack top then duplicate;
                       [66, 90, 65, 65]
    {::              : Shift the stack right 1 place then duplicate the stack top twice;
                       [90, 65, 65, 66, 66]
       o}            : Print the stack top then shift the stack left 1 place;
                       [66, 90, 65, 65, 66]
         =?\         : Comparison for equality on the top 2 stack items then move to line 1 if equal otherwise continue on line 2;
                       [66, 90, 65]
           \=?;      : Comparison for equality on the top 2 stack items then quit if equal else continue on line 1;
                       [66]
               1+    : Add 1 to the stack top;
                       [67]
                 40. : Move the code pointer to column 4 row 0 of the code box and continue execution of code. 

Teal pelican

Posted 2018-01-13T23:14:37.860

Reputation: 1 338

36 bytes. Your method is much better than mine – Jo King – 2018-01-16T09:41:52.717

inb4 "crossed out 44 is still 44 ;(" – Jo King – 2018-01-16T10:02:10.933

@JoKing Excellent spot with comparing to Z, only improvement I made was moving line logic and placing the Z in the middle of the stack items to save using those quote marks again. – Teal pelican – 2018-01-16T14:34:35.643

2

PowerShell, 56 bytes

"A";65..89|%{([char[]](65..$_)-join[char]++$_)+[char]$_}

Try it online!

Loops 65 to 89, each iteration constructing a char array of 65 to the current number $_, then -joins that array together into a string with the next character, then tacks on that character at the end.

Change the 89 to some other ASCII number to see the behavior better.

AdmBorkBork

Posted 2018-01-13T23:14:37.860

Reputation: 41 581

1

Jelly, 13 bytes

ØA¹Ƥ+"¹Ṗ€Yṭ”A

Try it online!

Explanation

ØA¹Ƥ+"¹Ṗ€Yṭ”A  Main Link
ØA              Uppercase Alphabet
  ¹Ƥ            Prefixes
    +"¹         Doubly-vectorized addition to identity (uppercase alphabet) (gives lists of lists of strings)
       Ṗ€      a[:-1] of each (get rid of the double letters at the end)
         Y     Join on newlines
          ṭ”A  "A" + the result

partially abuses the way strings and character lists differ in Jelly

HyperNeutrino

Posted 2018-01-13T23:14:37.860

Reputation: 26 575

That was quick! – FantaC – 2018-01-13T23:28:26.570

@tfbninja ehhh, 11 mins is ok for Jelly. thanks though :P – HyperNeutrino – 2018-01-13T23:29:27.937

You can replace your second ØA with ¹ (like Dennis's) – Jonathan Allan – 2018-01-14T00:04:17.797

@JonathanAllan oh cool, thanks! – HyperNeutrino – 2018-01-14T00:05:11.373

1

Jelly, 12 bytes

ØA;\;€Ṫ$€YFḊ

Try it online!

Bah just got ØAjṪ$ƤżØAY which is a step between this and the already posted solution of Dennis :/

Jonathan Allan

Posted 2018-01-13T23:14:37.860

Reputation: 67 804

1

Pyth, 13 bytes

+\ajmPjedd._G

Try it here!, Alternative

That leading a though...

Mr. Xcoder

Posted 2018-01-13T23:14:37.860

Reputation: 39 774

1Good morning :p – Jonathan Allan – 2018-01-13T23:53:45.837

@JonathanAllan Morning bro :p You and your inside jokes! – Mr. Xcoder – 2018-01-13T23:57:26.850

1

Acc!!, 84 bytes

This is actually what inspired this challenge:

Write 65
Count i while i-26 {
Count b while b-i {
Write b+65
Write i+65
}
Write 10
}

Try it online!

FantaC

Posted 2018-01-13T23:14:37.860

Reputation: 1 425

1

Python 2, 92 86 79 75 64 bytes

s=map(chr,range(65,91))
for d in s:print d.join(s[:ord(d)-65])+d

Try it online!

11 bytes thx to Rod.

Chas Brown

Posted 2018-01-13T23:14:37.860

Reputation: 8 959

you don't need to use '\n'.join(..) – Rod – 2018-01-14T01:03:01.313

1

APL+WIN, 51 bytes

⍎∊'a←⎕av[65+⍳26]⋄a[n←1]',25⍴⊂'⋄,⊃a[⍳n-1],¨a[n←n+1]'

Explanation:

a←⎕av[65+⍳26] create a vector of upper case letters

a[n←1] first A

25⍴⊂'⋄,⊃a[⍳n-1],¨a[n←n+1]' create an implicit loop to concatenate subsequent letters

Graham

Posted 2018-01-13T23:14:37.860

Reputation: 3 184

1

><>, 47 bytes

d2*:1-v
-&$:?!\$:&$:1
1-:?!v\69*-$1-:
+*88~< 1o

Try it online!

How It Works:

d2*:1-v Initialise the stack with 26 (outer loop counter) and 26-1 (inner loop counter)
....
....
....

....
-&$:?!\$:&$:1 Repeatedly make copies of both counters
....          And decrement the inner loop counter
....          Go to third line when inner loop counter is 0

....            Add -54 to the stack (for the newline) and decrement the outer loop counter
....            Initialise the inner loop counter as outer-1
1-:?!v\69*-$1-: If the inner counter is 0, go to the fourth line, else back to the second.
....

....
....      
....      Transform numbers and -54s into letters and newlines by adding 64
+*88~< 1o Output each character until it runs out of stack and errors

Jo King

Posted 2018-01-13T23:14:37.860

Reputation: 38 234

1

Canvas, 11 10 bytes

Z{Z²╷m¹*×]

Try it here!

dzaima

Posted 2018-01-13T23:14:37.860

Reputation: 19 048

1

GNU M4, 119 bytes

The worst so far. Well, time's already spent…

define(f,`ifelse($1,$2,,`format(%c%c,$1,$2)`'f(incr($1),$2)')')define(g,`f(65,$1)ifelse($1,90,,`
g(incr($1))')')A
g(66)

Thriller

Posted 2018-01-13T23:14:37.860

Reputation: 91

1

Ruby, 44 34 bytes

?A.upto(?Z){|w|puts [*?A...w]*w+w}

Try it online!

Thanks benj2240 for getting it down to 37 bytes. And of course crossed out 44 blah blah.

G B

Posted 2018-01-13T23:14:37.860

Reputation: 11 099

Here's a 37-byte version

– benj2240 – 2018-02-10T00:45:31.383

1

C# (.NET Core)

Port from Kevin Cruijssen's answer:

91 90 bytes

_=>{var t="";for(char c='@';++c<91;t+=c)Console.WriteLine(string.Join(c+"",t.Skip(0))+c);}

Try it online!

132 122 110 109 104 103 bytes

_=>"ABCDEFGHIJKLMNOPQRSTUVWXYZ".Select((c,i)=>string.Join(""+c,"ABCDEFGHIJKLMNOPQRSTUVWXYZ".Take(i))+c)

Try it online!

  • Replace () with _ to show that we declare an unused variable. Thank you Kevin Cruijssen.

aloisdg moving to codidact.com

Posted 2018-01-13T23:14:37.860

Reputation: 1 767

You can also reduce it to 90 bytes by using an empty unused parameter like I did in my Java answer. So o=>{...} instead of ()=>{...}. Try it online: 90 bytes.

– Kevin Cruijssen – 2018-01-15T13:19:23.990

@KevinCruijssen I didnt know! Thank you! – aloisdg moving to codidact.com – 2018-01-15T13:33:57.633

@KevinCruijssen I added this tip to Tips for code-golfing in C#

– aloisdg moving to codidact.com – 2018-01-15T13:42:53.340

1

Husk, 13 bytes

Γ·:mhSzJḣ…"AZ

Try it online!

Explanation

This leading A really messes things up -.-

          "AZ  -- string literal: "AZ"
         …     -- fill gaps: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     S         -- with alphabet and
        ḣ      -- | alphabet rangified: ["A","AB","ABC",…,"AB……XYZ"]
      zJ       -- : zipWith join: ["A","ABB","ACBCC","ADBDCDD",…,"AZB……ZYZZ"]
Γ              -- pattern match (x:xs) with the following function (x is "A" and xs ["ABB","ACBCC",…,"A……ZYZZ"]
 · mh          -- | drop the last element of each element of xs: ["AB","ACBC",…,"A……ZYZ"]
  :            -- | cons (construct list): ["A","AB","ACBC",…,"A……ZYZ"]
               -- : strings are printed implicitly

ბიმო

Posted 2018-01-13T23:14:37.860

Reputation: 15 345

1

Jelly, 22 bytes

ØAż€Ð€`F€µJ’Ḥ»1ż@¹ḣ/€Y

Try it online!

How it works:

                       take argument implicitly
ØA                     the uppercase alphabet
    Ѐ`                for C in the alphabet
  ż€                     appends C to every letter in the alphabet
       F€              flatten every sublist
          J            get indices
           ’           subtract 1
            Ḥ          and double
             »1        take max([n, 1])
         µ     ż@¹     interleave alphabet list and indices
                  ḣ/€  reduce on head() for each element
                     Y join on newline
                       implicitly output

ellie

Posted 2018-01-13T23:14:37.860

Reputation: 131

1

uBASIC, 80 bytes

Anonymous function that takes no input and outputs to the console

0?"A":ForI=65To89:ForJ=65ToI:?Left$(Chr$(J),1)+Left$(Chr$(I+1),1);:NextJ:?:NextI

Try it online!

Taylor Scott

Posted 2018-01-13T23:14:37.860

Reputation: 6 709

1

MY-BASIC, 77 bytes

Anonymous function that takes no input and outputs to the console.

Print"A";
For I=65 To 89
For J=65 To I
Print Chr(J)+Chr(I+1)
Next
Print;
Next

Try it online!

Taylor Scott

Posted 2018-01-13T23:14:37.860

Reputation: 6 709

1

Visual Basic .NET (Mono), 134 bytes

Declared function that takes no input and outputs to the console

Module M
Sub Main
Dim S,I,J
S="A"
For I=65To 90
Console.WriteLine(S)
S=""
For J=65To I
S+=Chr(J)+Chr(I+1)
Next
Next
End Sub
End Module

Try it online!

Taylor Scott

Posted 2018-01-13T23:14:37.860

Reputation: 6 709

1

Yabasic, 60 bytes

?"A"
For I=65To 89
For J=65To I?Chr$(J)+Chr$(I+1);Next
?Next

Try it online!

Taylor Scott

Posted 2018-01-13T23:14:37.860

Reputation: 6 709

1

05AB1E, 29 bytes

'A,Au©.sRí¦®RSDgÝ×Rs)ø˜.Bíø»=

Try it online!

Magic Octopus Urn

Posted 2018-01-13T23:14:37.860

Reputation: 19 422

1

Perl 5, 39 38 bytes

@DomHastings shaved off a byte

say$.=A;say map$_.$.,A..$.++while$.!~Z

Try it online!

Xcali

Posted 2018-01-13T23:14:37.860

Reputation: 7 671

Nice solution, I've played with this a bit and managed to get a slightly different approach, but with this, you can save 1 cheeky byte using $.!~Z vs. $.ne Z! – Dom Hastings – 2018-07-13T12:03:41.790

1

brainfuck, 96 bytes

+++++[->+++++>++>+++++++++++++>+++++++++++++<<<<]>>>.<.<[->>>+>+[-<<.+>.>>+<]>[-<+<<->>>]<<<<.<]

Try it online!

Tape Layout:

[Init] [Line Count] [newline] [Growing Ascii] [Repeated Ascii] [Loop 1] [Loop 2]

Explanation:

+++++[->+++++>++                      Sets Line counter and newline cell
    >+++++++++++++>+++++++++++++<<<<] Sets Ascii cells to 65 ('A')
>>>.<.<                               Prints first "A" and moves to Line loop
  [->>>+>+                            Increment Repeated Ascii cell in outer loop
      [-<<.+>.>>+<]>                  Increment Growing Ascii cell in inner loop,
                                         Prints both Ascii cells and Sets Loop 2
      [-<+<<->>>]                     Resets Growing cell and Loop 1
  <<<<.<]                             Prints newline and moves to next Line

X1M4L

Posted 2018-01-13T23:14:37.860

Reputation: 1 586

1

brainfuck, 81 bytes

+++[[->++<<+>]>]<<,<[----<<+>>]<+<+.<+<--.>[>+>>+[-<.+<.>>>+<]>[-<+<->>]<<<<<.>-]

Try it online!

Prints in lowercase

Explanation:

+++[[->++<<+>]>]  Sets up the tape as 3*2^n (3,6,12,24,48,96,192,128)
<<,               Removes excess 128
<[----<<+>>]      Adds 196/4 to 48 resulting in 96
<+<+.             Add 1 to both 96s and print A
<+<--.            Add 1 to 25, subtract 2 from 12 to print a newline
                  Tape: 3 6 10 25 96 96 0 0
>[ Start loop
   >+>>+          Add one to the unchanging ASCII and the inner loop counter
   [-<.+<.>>>+<]  Print row while preserving counter
   >[-<+<->>]     Undo changes to changing ASCII and return inner loop counter to its cell
   <<<<<.>-       Print newline and decrement loop counter
]

Jo King

Posted 2018-01-13T23:14:37.860

Reputation: 38 234

This is really short but needs a specific interpreter with the following features:

  • negative pointer or pointer wrapping
  • cell wrapping
  • cell size 8 bits
  • end of input = 0

If the interpreter doesn't support any of these, it will produce garbish – Dorian – 2018-07-13T09:52:51.360

@Dorian Generally, any type of interpreter that exists is valid on this site (though most I've seen have used the described specifications) . I will be sure to include which interpreter type I'm using in future answers though thanks – Jo King – 2018-07-13T12:40:40.340

1

brainfuck, 88 bytes

++++++++[->+++>+>++++++++>++++++++<<<<]>+>++>+.<.<[->>+>>+[-<+.<.>>>+<]>[-<+<->>]<<<<.<]

Try it online!

should run on all brainfuck interpreters. No wrapping or negative values, no undefined input behaviour, values between 0 and 90.

How it works

Initialize tape: 25(row count) 10(lf) 64(row letter) 64(col letter) 0(col count) 0(temp)
++++++++[->+++>+>++++++++>++++++++<<<<]>+>++ 

>+.<.            print "A" and lf
<[               for each letter count
  -                decrement letter count
  >>+              increment row letter
  >>+              increment col count
  [                do col count times
    -                decrement col count
    <+.              increment and print col letter
    <.               print row letter
    >>>+             move col count to temp
    <                return to colcount
  ]
  >[-<+<->>]       move value from temp back to col count and set col letter back to "A" minus 1
  <<<<.            print lf
  <                return to row count
]

Dorian

Posted 2018-01-13T23:14:37.860

Reputation: 1 521

0

Clean, 74 72 bytes

import StdEnv
Start=("A",[(zip2['A'..s-one][s,s..],'
')\\s<-['A'..'Z']])

Try it online!

This actually doesn't print a String, but rather a bare (String, [([(Char, Char)], Char)]), which is functionally the same. Unless you grab the output from this with another Clean program.

Οurous

Posted 2018-01-13T23:14:37.860

Reputation: 7 916

0

J, 38, 33 30 bytes

-5 bytes thanks to Bolce Bussiere

-3 bytes thanks to FrownyFrog

'A ',}.(}:,@,.{:)\(65+i.26){a.

How?

(65+i.26){a. - uppercase alphabet

\ - prefixes

(}:,@,.{:) - drops the last letter from each prefix and inserts it between the remaining letters

}. drops the leading row since it's empty (not "A")

, - append

'A ' - "A"

Try it online!

Galen Ivanov

Posted 2018-01-13T23:14:37.860

Reputation: 13 815

1You can use (,.'A') instead of ('A',49$' ') :) – Bolce Bussiere – 2018-01-15T05:13:23.817

@Bolce Bussiere Thanks, it's much better now! – Galen Ivanov – 2018-01-15T07:42:23.083

1

Just append 'A ' TIO

– FrownyFrog – 2018-01-15T08:47:02.143

@FrownyFrog Thanks! I didn't know it works. Only the space is used as a fill? – Galen Ivanov – 2018-01-15T08:52:58.223

@GalenIvanov The space is the default fill, it doesn’t come from the 'A '. – FrownyFrog – 2018-01-15T09:03:16.757

@FrownyFrog I think I got it: 'A' is an atom, so it would be repeated to match the length of the 1-cells, resulting in a list of 50 As. 'A ' is a list, so it's filled with spaces to match the length. – Galen Ivanov – 2018-01-15T11:09:32.500

@GalenIvanov Yes, that’s why (,'A') instead of (,.'A') also works. – FrownyFrog – 2018-01-15T16:07:25.963

0

C (gcc), 77 bytes

f(i,j){for(i=0;i<26;puts("A"+!!i++))for(j=0;j<i;)printf("%c%c",j+++65,i+65);}

Try it online!

gastropner

Posted 2018-01-13T23:14:37.860

Reputation: 3 264

0

Java 8, 121 bytes

I know there are better approaches but wanted to try it :)

q->{String s="";for(int i=0;i<26;i++){for(int j=0;j<((i<1)?1:i*2);j++){s+=(char)((j%2!=0?i:j/2)+65);}s+="\n";}return s;}

ungolfed:

static String d(){
    String s="";
    for(int i=0;i<26;i++){      //Loop for each line
        for(int j=0;j<((i<1)?1:i*2);j++){ //Loop to create the "word"
            s+=(char)((j%2!=0?i:j/2)+65);
        }
        s+="\n";
    }
    return s;
}

Java Gonzar

Posted 2018-01-13T23:14:37.860

Reputation: 173

110 bytes – ceilingcat – 2019-12-05T21:41:11.663

0

Red, 130 122 bytes

prin"A"repeat n 26[b: copy/part"ABCDEFGHIJKLMNOPQRSTUVWXYZ"n
foreach d copy/part b back tail b[prin d prin last b]print""]

Try it online!

Galen Ivanov

Posted 2018-01-13T23:14:37.860

Reputation: 13 815

0

VBA, 60 Bytes

Anonymous VBE immediate window that takes no input and outputs to the VBE immediate window

?"A":For i=65To 89:For j=65To i:?Chr(j)Chr(i+1);:Next:?:Next

Taylor Scott

Posted 2018-01-13T23:14:37.860

Reputation: 6 709

0

F# (.NET Core), 132 bytes

let x=['A'..'Z']|>Seq.map(fun c->(+)(['A'..'Z']|>Seq.take((int c)-65)|>Seq.map(fun s->string s)|>String.concat(string c))(string c))

Try it online!

A naive port of my C# answer

aloisdg moving to codidact.com

Posted 2018-01-13T23:14:37.860

Reputation: 1 767

0

Perl 6, 51 bytes

.say for 'A',{join |('A'..'Z')[++$,^++$ ],''}.../Z/

Try it

Expanded:

.say     # print with trailing newline

  for    # each of the following

    # start the sequence
    'A',

    # code used to generate the rest of the sequence
    {
      join
        | # flatten arguments

        ( 'A' .. 'Z' )[  # Range of characters
          ++$,           # auto incrementing anon state var (value used to join)
          ^++$           # Range upto an incrementing anon
        ],
        ''               # an empty string so that the joiner is added to end
    }

    ...  # keep doing that until
    /Z/  # there is a "Z" in the value

Brad Gilbert b2gills

Posted 2018-01-13T23:14:37.860

Reputation: 12 713

0

QBasic 1.1, 62 bytes

Takes no input and outputs to the STDIN

?"A"
FOR i=65TO 89
FOR j=65TO i
?CHR$(j)CHR$(i+1);
NEXT
?
NEXT

Taylor Scott

Posted 2018-01-13T23:14:37.860

Reputation: 6 709

0

Kotlin, 76 bytes

{for(l in 'A'..'Z'){for(c in 'A'..l){print(c)
if(c+1<l)print(l)}
println()}}

Try it online!

JohnWells

Posted 2018-01-13T23:14:37.860

Reputation: 611

0

Perl 5, 35 bytes

@a=A..$_,$"=pop@a,say"@a$_"for A..Z

Try it online!

I managed to get frustratingly close for 23 bytes, but the above is the shortest valid solution I've managed so far:

$,=$_,say A..$,for A..Z

Try it online!

Dom Hastings

Posted 2018-01-13T23:14:37.860

Reputation: 16 415

0

05AB1E, 12 bytes

AuηćsvyS¤ý¨»

Try it online.

Explanation:

Au            # Push the uppercase alphabet
  η           # Pop and push its prefixes
   ć          # Extract the head; pop and push the remainder and head
    sv        # Loop `y` over each of the remainder prefixes:
      yS      #  Convert `y` to a list of characters
        ¤     #  Push it's last character (without popping)
         ý    #  Join the characters by this character
          ¨   #  Remove the last character of the string
           »  #  And join the entire stack by newlines
              # (after the loop, the result is output implicitly)

Kevin Cruijssen

Posted 2018-01-13T23:14:37.860

Reputation: 67 575