Back
Close

Spiralia

Statement
A message is encoded in a square [[N]] by [[N]] grid. The first character of the message is in the top-left corner of the grid and the remaining characters are placed in the grid in an inwards clockwise spiral pattern. Decode the message.

Input description
<<Line 1:>> One integer [[N]], the side length of the square grid. <<Next [[N]] Lines:>> [[N]] characters on each line.

Output description
<<Line 1:>> The decoded message.

Constraints
1 ≤ [[N]] ≤ 25

Game modes
Fastest, Reverse

Test cases
CodinGame Test
Input
3 Cod mei aGn
Output
CodinGame

Validator 1 Validator
Input
3 !@# *($ &^%
Output
!@#$%^&*(

Who Am I? Test
Input
4 [VE_ ERNF D]EO YRBR
Output
[VE_FORBRYDERNE]

Validator 2 Validator
Input
4 [VE_ FORB RYDE RNE]
Output
[VE_BE]ENRRFORDY

Symbols Test
Input
7 #-----+ +----+| |+--+|| ||+#||| ||+-+|| |+---+| +-----+
Output
#-----+|||||+-----+||||+----+|||+---+||+--+|+-++#

Validator 3 Validator
Input
10 !"#$%&()*+ FGHIJKLMN, EbcdefghO. DavwxyziP/ C`uXXX{jQ0 B_tX X|kR1 A^s-'~}lS2 @]rqponmT3 ?\[ZYXWVU4 >=<;:98765
Output
!"#$%&()*+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'-XXXXX

Quaint Test
Input
1 X
Output
X

Validator 4 Validator
Input
2 AB DC
Output
ABCD

Zimmermann Test
Input
9 We intend submari dill kent ew. neeeo t Sl.up ce.art wb iWU ehtae r .erafrg tsernu ni
Output
We intend to begin unrestricted submarine warfare. We will keep the U.S. neutral.

Validator 5 Validator
Input
9 We intend to begin unrestri cted subm arine war fare. We will keep the U.S. neutral.
Output
We intendnimr p..lartuen wfac to begirbaeeS.U ehtiartunrestuwWek llried s .ene

Secret of Psalm 46 Test
Input
25 You're spending too much If you're finished writit essage that I have intni .mhis message. Do not egm e te nothing to offerwn e ds vipher here. It's aty oigacd ciphers wher ynior chnh ivery word anenodoue ti ope is fillerd ouenra e dsnu sns exact yt.ra d tnad tmiind twelsso lci iienysohaaharanyotuaJilon rhral rTt cs!ct r unydg wt llef nd retystitss e ip as .oeevif-ihnakttp,t dwoeuorrcrdnuh xegki hu h n tsthee egassem epsetpi atSectthtegot meht os ls e ha tel tsrif ehtc eie sr.t fo eno ro rehpiy nat ics si ereht ,wonk uod se heurof ,setsaw etalosehes tsoires gnieb ma I .ere t on si erehT .ti timbus gnidaer potS !tuptuo esac
Output
You're spending too much time reading this test case output! Stop reading this and write code. If you're finished writing your code, please submit it. There is no secret within this message that I have intentionally put in here. I am being serious. Stop reading this message. Do not wander in these desolate wastes, for these lands have nothing to offer you. Just so you know, there is actually no cipher here. It's not a skip cipher or one of those stupid ciphers where you take the first letter from every word and string them together. This is filler so the message contains exactly six hundred and twenty-five characters!

Validator 6 Validator
Input
24 3.1415926535897932384626 534211706798214808651324 211055596446229489549383 821456485669234603486023 459817488152092096281338 380865213841469519420803 039563819326117931194162 891547575272489120525967 210101824406566425154649 602321867371907371143475 871686134277050091602400 927088532062932838096292 902641372771391685916838 815652765317127014474888 046009639490689288318144 281030533649493130352041 623753989219491107031969 808805472699732644563707 257539195957563072743591 646431100630952987639656 078273721419420627063659 417332846574821644339503 611848218049535271322859 187032954494790285015739
Output
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931

Solution language

Solution

Stub generator input