Skip to main content
Tweeted twitter.com/StackCodeGolf/status/900336427858354176
added 130 characters in body
Source Link
Dom Hastings
  • 24.4k
  • 4
  • 56
  • 93

Given a square string, produce all the output for the string at every stage of unfurling.

The string must unfurl in a clockwise direction one quarter turn at a time.

Examples

Input:

A

Output:

A

Note: I'll also accept the input duplicated for this particular test case only if this helps reduce your byte count.

Input:

DC
AB

Output:

DC
AB

  D
ABC

ABCD

Input:

GFE
HID
ABC

Output:

GFE
HID
ABC

   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

Input:

JIHG
KPOF
LMNE
ABCD

Output:

JIHG
KPOF
LMNE
ABCD

    LKJ
    MPI
    NOH
ABCDEFG

       NML
       OPK
ABCDEFGHIJ

          ON
          PM
ABCDEFGHIJKL

            PO
ABCDEFGHIJKLMN

              P
ABCDEFGHIJKLMNO

ABCDEFGHIJKLMNOP

Rules

This is so the shortest code in bytes wins.

  • Any reasonable format can be used for I/O assuming it is consistent.
  • Spaces must be used to pad the top lines of the output.
  • Must be able to handle input of all printable characters (including space: \x20-\x7e):
 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • Leading/trailing whitespace is allowed.
  • You can assume the string will always be a square.
  • All standard loopholes are forbidden.

Inspiration: Write a square program that outputs the number of times it has been “unrolled”.

Given a square string, produce all the output for the string at every stage of unfurling.

The string must unfurl in a clockwise direction one quarter turn at a time.

Examples

Input:

A

Output:

A

Input:

DC
AB

Output:

DC
AB

  D
ABC

ABCD

Input:

GFE
HID
ABC

Output:

GFE
HID
ABC

   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

Input:

JIHG
KPOF
LMNE
ABCD

Output:

JIHG
KPOF
LMNE
ABCD

    LKJ
    MPI
    NOH
ABCDEFG

       NML
       OPK
ABCDEFGHIJ

          ON
          PM
ABCDEFGHIJKL

            PO
ABCDEFGHIJKLMN

              P
ABCDEFGHIJKLMNO

ABCDEFGHIJKLMNOP

Rules

This is so the shortest code in bytes wins.

  • Any reasonable format can be used for I/O assuming it is consistent.
  • Spaces must be used to pad the top lines of the output.
  • Must be able to handle input of all printable characters (including space: \x20-\x7e):
 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • Leading/trailing whitespace is allowed.
  • You can assume the string will always be a square.
  • All standard loopholes are forbidden.

Inspiration: Write a square program that outputs the number of times it has been “unrolled”.

Given a square string, produce all the output for the string at every stage of unfurling.

The string must unfurl in a clockwise direction one quarter turn at a time.

Examples

Input:

A

Output:

A

Note: I'll also accept the input duplicated for this particular test case only if this helps reduce your byte count.

Input:

DC
AB

Output:

DC
AB

  D
ABC

ABCD

Input:

GFE
HID
ABC

Output:

GFE
HID
ABC

   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

Input:

JIHG
KPOF
LMNE
ABCD

Output:

JIHG
KPOF
LMNE
ABCD

    LKJ
    MPI
    NOH
ABCDEFG

       NML
       OPK
ABCDEFGHIJ

          ON
          PM
ABCDEFGHIJKL

            PO
ABCDEFGHIJKLMN

              P
ABCDEFGHIJKLMNO

ABCDEFGHIJKLMNOP

Rules

This is so the shortest code in bytes wins.

  • Any reasonable format can be used for I/O assuming it is consistent.
  • Spaces must be used to pad the top lines of the output.
  • Must be able to handle input of all printable characters (including space: \x20-\x7e):
 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • Leading/trailing whitespace is allowed.
  • You can assume the string will always be a square.
  • All standard loopholes are forbidden.

Inspiration: Write a square program that outputs the number of times it has been “unrolled”.

remove tags from the posts body as they are displayed separately
Source Link
dzaima
  • 20.3k
  • 2
  • 41
  • 75

Given a square string, produce all the output for the string at every stage of unfurling.

The string must unfurl in a clockwise direction one quarter turn at a time.

Examples

Input:

A

Output:

A

Input:

DC
AB

Output:

DC
AB

  D
ABC

ABCD

Input:

GFE
HID
ABC

Output:

GFE
HID
ABC

   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

Input:

JIHG
KPOF
LMNE
ABCD

Output:

JIHG
KPOF
LMNE
ABCD

    LKJ
    MPI
    NOH
ABCDEFG

       NML
       OPK
ABCDEFGHIJ

          ON
          PM
ABCDEFGHIJKL

            PO
ABCDEFGHIJKLMN

              P
ABCDEFGHIJKLMNO

ABCDEFGHIJKLMNOP

Rules

This is so the shortest code in bytes wins.

  • Any reasonable format can be used for I/O assuming it is consistent.
  • Spaces must be used to pad the top lines of the output.
  • Must be able to handle input of all printable characters (including space: \x20-\x7e):
 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • Leading/trailing whitespace is allowed.
  • You can assume the string will always be a square.
  • All standard loopholes are forbidden.

Inspiration: Write a square program that outputs the number of times it has been “unrolled”.

Given a square string, produce all the output for the string at every stage of unfurling.

The string must unfurl in a clockwise direction one quarter turn at a time.

Examples

Input:

A

Output:

A

Input:

DC
AB

Output:

DC
AB

  D
ABC

ABCD

Input:

GFE
HID
ABC

Output:

GFE
HID
ABC

   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

Input:

JIHG
KPOF
LMNE
ABCD

Output:

JIHG
KPOF
LMNE
ABCD

    LKJ
    MPI
    NOH
ABCDEFG

       NML
       OPK
ABCDEFGHIJ

          ON
          PM
ABCDEFGHIJKL

            PO
ABCDEFGHIJKLMN

              P
ABCDEFGHIJKLMNO

ABCDEFGHIJKLMNOP

Rules

This is so the shortest code in bytes wins.

  • Any reasonable format can be used for I/O assuming it is consistent.
  • Spaces must be used to pad the top lines of the output.
  • Must be able to handle input of all printable characters (including space: \x20-\x7e):
 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • Leading/trailing whitespace is allowed.
  • You can assume the string will always be a square.
  • All standard loopholes are forbidden.

Inspiration: Write a square program that outputs the number of times it has been “unrolled”.

Given a square string, produce all the output for the string at every stage of unfurling.

The string must unfurl in a clockwise direction one quarter turn at a time.

Examples

Input:

A

Output:

A

Input:

DC
AB

Output:

DC
AB

  D
ABC

ABCD

Input:

GFE
HID
ABC

Output:

GFE
HID
ABC

   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

Input:

JIHG
KPOF
LMNE
ABCD

Output:

JIHG
KPOF
LMNE
ABCD

    LKJ
    MPI
    NOH
ABCDEFG

       NML
       OPK
ABCDEFGHIJ

          ON
          PM
ABCDEFGHIJKL

            PO
ABCDEFGHIJKLMN

              P
ABCDEFGHIJKLMNO

ABCDEFGHIJKLMNOP

Rules

This is so the shortest code in bytes wins.

  • Any reasonable format can be used for I/O assuming it is consistent.
  • Spaces must be used to pad the top lines of the output.
  • Must be able to handle input of all printable characters (including space: \x20-\x7e):
 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • Leading/trailing whitespace is allowed.
  • You can assume the string will always be a square.
  • All standard loopholes are forbidden.

Inspiration: Write a square program that outputs the number of times it has been “unrolled”.

fix typo mentioned by @StanStrum
Source Link
dzaima
  • 20.3k
  • 2
  • 41
  • 75

Given a square string, produce all the output for the string at every stage of unfurling.

The string must unfurl in a clockwise direction one quarter turn at a time.

Examples

Input:

A

OuputOutput:

A

Input:

DC
AB

Output:

DC
AB

  D
ABC

ABCD

Input:

GFE
HID
ABC

Output:

GFE
HID
ABC

   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

Input:

JIHG
KPOF
LMNE
ABCD

Output:

JIHG
KPOF
LMNE
ABCD

    LKJ
    MPI
    NOH
ABCDEFG

       NML
       OPK
ABCDEFGHIJ

          ON
          PM
ABCDEFGHIJKL

            PO
ABCDEFGHIJKLMN

              P
ABCDEFGHIJKLMNO

ABCDEFGHIJKLMNOP

Rules

This is so the shortest code in bytes wins.

  • Any reasonable format can be used for I/O assuming it is consistent.
  • Spaces must be used to pad the top lines of the output.
  • Must be able to handle input of all printable characters (including space: \x20-\x7e):
 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • Leading/trailing whitespace is allowed.
  • You can assume the string will always be a square.
  • All standard loopholes are forbidden.

Inspiration: Write a square program that outputs the number of times it has been “unrolled”.

Given a square string, produce all the output for the string at every stage of unfurling.

The string must unfurl in a clockwise direction one quarter turn at a time.

Examples

Input:

A

Ouput:

A

Input:

DC
AB

Output:

DC
AB

  D
ABC

ABCD

Input:

GFE
HID
ABC

Output:

GFE
HID
ABC

   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

Input:

JIHG
KPOF
LMNE
ABCD

Output:

JIHG
KPOF
LMNE
ABCD

    LKJ
    MPI
    NOH
ABCDEFG

       NML
       OPK
ABCDEFGHIJ

          ON
          PM
ABCDEFGHIJKL

            PO
ABCDEFGHIJKLMN

              P
ABCDEFGHIJKLMNO

ABCDEFGHIJKLMNOP

Rules

This is so the shortest code in bytes wins.

  • Any reasonable format can be used for I/O assuming it is consistent.
  • Spaces must be used to pad the top lines of the output.
  • Must be able to handle input of all printable characters (including space: \x20-\x7e):
 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • Leading/trailing whitespace is allowed.
  • You can assume the string will always be a square.
  • All standard loopholes are forbidden.

Inspiration: Write a square program that outputs the number of times it has been “unrolled”.

Given a square string, produce all the output for the string at every stage of unfurling.

The string must unfurl in a clockwise direction one quarter turn at a time.

Examples

Input:

A

Output:

A

Input:

DC
AB

Output:

DC
AB

  D
ABC

ABCD

Input:

GFE
HID
ABC

Output:

GFE
HID
ABC

   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

Input:

JIHG
KPOF
LMNE
ABCD

Output:

JIHG
KPOF
LMNE
ABCD

    LKJ
    MPI
    NOH
ABCDEFG

       NML
       OPK
ABCDEFGHIJ

          ON
          PM
ABCDEFGHIJKL

            PO
ABCDEFGHIJKLMN

              P
ABCDEFGHIJKLMNO

ABCDEFGHIJKLMNOP

Rules

This is so the shortest code in bytes wins.

  • Any reasonable format can be used for I/O assuming it is consistent.
  • Spaces must be used to pad the top lines of the output.
  • Must be able to handle input of all printable characters (including space: \x20-\x7e):
 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • Leading/trailing whitespace is allowed.
  • You can assume the string will always be a square.
  • All standard loopholes are forbidden.

Inspiration: Write a square program that outputs the number of times it has been “unrolled”.

Source Link
Dom Hastings
  • 24.4k
  • 4
  • 56
  • 93
Loading