答:
Objective-C / C, 50 bytes

puts(){printf("trick");}main(){printf("treat\n");}
```

Objective-C got candy and prints treat, but C didn't and prints trick.

How it works

I don't know a lot about Objective-C, but it does what we'd reasonably expect in this situation. The re-definition of puts doesn't affect the output since we never call the function, and main prints treat and a linefeed to STDOUT.

You might expect C to do the same, but at least gcc 4.8, gcc 5.3, and clang 3.7 don't.

Since we do not need the real printf (which takes a format string and additional arguments) and the string to be printed ends with a linefeed, we can use puts instead. puts is slightly faster than printf (which has to analyze its arguments before printing), so unless we redefine the function printf as well, the compiler optimizes and replaces the call to printf with a call to puts. Little does the compiler know that calling puts with argument "treat" will print trick instead!

Not including stdio.h is crucial here, since defining puts would require using the same type it has in the header file (puts(const char*)).

Finally, it is noteworthy that the call to printf in puts passes a string without a trailing linefeed. Otherwise, the compiler would "optimize" that call as well, resulting in a segmentation fault.

Title: Trick or Treat polyglot

Body:
Objective-C / C, 50 bytes

puts(){printf("trick");}main(){printf("treat\n");}

Objective-C got candy and prints treat, but C didn't and prints trick.

How it works

I don't know a lot about Objective-C, but it does what we'd reasonably expect in this situation. The re-definition of puts doesn't affect the output since we never call the function, and main prints treat and a linefeed to STDOUT.

You might expect C to do the same, but at least gcc 4.8, gcc 5.3, and clang 3.7 don't.

Since we do not need the real printf (which takes a format string and additional arguments) and the string to be printed ends with a linefeed, we can use puts instead. puts is slightly faster than printf (which has to analyze its arguments before printing), so unless we redefine the function printf as well, the compiler optimizes and replaces the call to printf with a call to puts. Little does the compiler know that calling puts with argument "treat" will print trick instead!

Not including stdio.h is crucial here, since defining puts would require using the same type it has in the header file (puts(const char*)).

Finally, it is noteworthy that the call to printf in puts passes a string without a trailing linefeed. Otherwise, the compiler would "optimize" that call as well, resulting in a segmentation fault.


问:
Tips for golfing in C
What general tips do you have for golfing in C? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C (e.g. "remove comments" is not an answer). Please post one tip per answer. Also, please include if your tip applies to C89 and/or C99 and if it only works on certain compilers.</p>

答:
import if you have to

As noted in the very first answer, some compilers (notably, GCC and clang) let you get away with omitting #includes for standard library functions.

Even if you can't just remove the #include, there might be other ways to avoid it, but that's not always practical or particularly golfy.

In the remaining cases, you can use #import instead of #include to save a byte. This is a GNU extension and it is considered deprecated, but it works at least in gcc 4.8, gcc 5.1, and clang 3.7.

ContentLicense: CC BY-SA 3.0

Title: Tips for golfing in C

Body:
import if you have to

As noted in the very first answer, some compilers (notably, GCC and clang) let you get away with omitting #includes for standard library functions.

Even if you can't just remove the #include, there might be other ways to avoid it, but that's not always practical or particularly golfy.

In the remaining cases, you can use #import<header file> instead of #include<header file> to save a byte. This is a GNU extension and it is considered deprecated, but it works at least in gcc 4.8, gcc 5.1, and clang 3.7.


问:
Encode the alphabet cipher
Given a string that contains only lowercase letters, encode that string with the alphabet cipher.

To encode with the alphabet cipher (I will be using the example hello):

First, convert each letter in the string to a number depending on its position in the alphabet (a = 1, b = 2, etc.) Example: 8 5 12 12 15

Pad each number to two characters with 0s. Example: 08 05 12 12 15

Join. Example: 0805121215

Test cases

```<code>helloworld -> 08051212152315181204
codegolf -> 0315040507151206
alphabetcipher -> 0112160801020520030916080518
johncena -> 1015081403051401
</code>```

Remember, this is code-golf, so the code with the fewest number of bytes wins.

答:
Actually, 10 bytes

Using the neat algorithm in Adnan's 05AB1E answer. Golfing suggestions welcome. Try it online!

```<code>O4+`$pX`MΣ
</code>```

Ungolfing

```<code>         Implicit input s.
O        ord() every char in s.
4+       Add 4 to every ord in s.
`...`M   Map the following function over s. Variable m.
  $        Push str(m).
  pX       Discard the first char of str(m).
           Invariably this is a `1` and we get our ciphered m.
Σ        sum() everything to get one string.
         Implicit return.
</code>```

ContentLicense: CC BY-SA 4.0

Title: Encode the alphabet cipher

Body:
Actually, 10 bytes

Using the neat algorithm in Adnan's 05AB1E answer. Golfing suggestions welcome. Try it online!

O4+`$pX`MΣ

Ungolfing

         Implicit input s.
O        ord() every char in s.
4+       Add 4 to every ord in s.
`...`M   Map the following function over s. Variable m.
  $        Push str(m).
  pX       Discard the first char of str(m).
           Invariably this is a `1` and we get our ciphered m.
Σ        sum() everything to get one string.
         Implicit return.


问:
Compute the Eulerian number
The Eulerian number A(n, m) is the number of permutations of [1, 2, ..., n] in which exactly m elements are greater than the previous element. These are also called rises. For example, if n = 3, there are 3! = 6 permutations of [1, 2, 3]

```<code>1 2 3
 < <  2 elements are greater than the previous

1 3 2
 < >  1 ...

2 1 3
 > <  1 ...

2 3 1
 < >  1 ...

3 1 2
 > <  1 ...

3 2 1
 > >  0 ...
</code>```

So the outputs for A(3, m) for m in [0, 1, 2, 3] will be

```<code>A(3, 0) = 1
A(3, 1) = 4
A(3, 2) = 1
A(3, 3) = 0
</code>```

Also, this is the OEIS sequence A173018.

Rules

This is code-golf so the shortest code wins.

The input n will be a nonnegative integer and m will be a integer in the range [0, 1, ..., n].

Test Cases

```<code>n   m   A(n, m)
0   0   1
1   0   1
1   1   0
2   0   1
2   1   1
2   2   0
3   0   1
3   1   4
3   2   1
3   3   0
4   0   1
4   1   11
4   2   11
4   3   1
4   4   0
5   1   26
7   4   1191
9   5   88234
10  5   1310354
10  7   47840
10  10  0
12  2   478271
15  6   311387598411
17  1   131054
20  16  1026509354985
42  42  0
</code>```

答:
Swift 3, 82 88 Bytes

func A(_ n:Int,_ m:Int)->Int{return m<1 ?1:n>m ?(n-m)*A(n-1,m-1)+(m+1)*A(n-1,m):0}

Just the same recursive formula in a language that is definitely not for golf

Title: Compute the Eulerian number


问:
Output a googol copies of a string
I am interested in seeing programs which don't ask for any input, print a googol copies of some nonempty string, no less, no more, and then stop. A googol is defined as \$10^{100}\$, i.e., 1 followed by a hundred 0's in decimal.

Example output:

```<code>111111111111111111111111111111111111111111111111111111111111111111111111...
</code>```

or

```<code>Hello world
Hello world
Hello world
Hello world
Hello world
Hello world
...
</code>```

The string can also be entirely composed of white space or special symbols. The only exception to identical copies of a fixed string is if your language decorates the output in some way that can not be prevented, but could be trivially undone in a wrapper script, like prepending a line number to each line. The wrapper script in such cases need not be provided.

You can assume your computer will never run out of time, but other than that, your program must have a reasonable demand of resources. Also, you must respect any restrictions that the programming language of your choice poses, for example, you can not exceed a maximum value allowed for its integer types, and at no point more than 4 GB of memory must be needed.

In other words, the program should in principle be testable by running it on your computer. But because of the extent of this number you will be expected to prove that the number of copies of the string it outputs is exactly 10^100 and that the program stops afterwards. Stopping can be exiting or halting or even terminating due to an error, but if so, the error must not produce any output that could not easily be separated from the program's output.

This is code-golf,  so the solution with the fewest bytes wins.

Example solution (C, ungolfed, 3768 bytes)

```<code>#include <stdio.h>

int main() {
  int a00, a01, a02, a03, ..., a99;
  for(a00 = 0; a00 < 10; a00++)
  for(a01 = 0; a01 < 10; a01++)
  for(a02 = 0; a02 < 10; a02++)
  for(a03 = 0; a03 < 10; a03++)
  ...
  for(a99 = 0; a99 < 10; a99++)
    puts("1");
  return 0;
}
</code>```

答:
Common Lisp, 33

```<code>(dotimes(i(expt 10 100))(terpri))
</code>```

Print newlines.

Title: Output a googol copies of a string

Body:
Common Lisp, 33

(dotimes(i(expt 10 100))(terpri))

Print newlines.


问:
Encode the column cipher
Given a string to encode, and a number of columns (the key), encode the string as follows:

I will be using the example Hello, world! and the key 3

First, write out the number of columns:

```<code>1 2 3
</code>```

Next, write the text starting from the upper left, one character per column, and when you run out of columns, go to the next line.

```<code>1 2 3
H e l
l o ,
  w o
r l d
!
</code>```

Now, to get your encoded text, read the text starting from the top left corner, but this time, first read one column, and then the next, and so on. If there is not a character in the slot, put a space.

```<code>Hl r!eowl l,od
</code>```

Note that here, there is a trailing space.

This is your encoded text.

Another test case is Programming Puzzles and Code Golf SE with key 5:

```<code>1 2 3 4 5
P r o g r
a m m i n
g   P u z
z l e s
a n d   C
o d e   G
o l f   S
E
</code>```

The encoded text is PagzaooErm lndl omPedef gius    rnz CGS.

More test cases

```<code>"abcdefghijklmnopqrstuvwxyz", 2 -> "acegikmoqsuwybdfhjlnprtvxz"
"codegolf.stackexchange.com", 4 -> "cg.ccgoooskhemdltea. efaxnc "
"Pen Pineapple Apple Pen!!!", 7 -> "PeAeeapnnpp! pl!Ple!ie  n P "
"1,1,2,3,5,8,13,21,34,55,89", 10 -> "18,,,5115,3,2,8,2931 ,, 53 ,4 "
</code>```

Remember, this is code-golf, so the code with the fewest bytes wins.

答:
R, 92 81 bytes

```<code>function(x,n)cat(t(matrix(c(el(strsplit(x,"")),rep(" ",-nchar(x)%%n)),n)),sep="")
</code>```

Try it on R-fiddle

This turned out to be a bit of a headache because R automatically recycles the input vector when the rows or column specified in the matrix creation is not a multiple of the length of the input. Therefore we have to pad the vector with -nchar(x)%%n spaces before passing it to the matrix function.

The last step is just transposing the matrix and printing it.

Title: Encode the column cipher

Body:
R, 92 81 bytes

function(x,n)cat(t(matrix(c(el(strsplit(x,"")),rep(" ",-nchar(x)%%n)),n)),sep="")

Try it on R-fiddle

This turned out to be a bit of a headache because R automatically recycles the input vector when the rows or column specified in the matrix creation is not a multiple of the length of the input. Therefore we have to pad the vector with -nchar(x)%%n spaces before passing it to the matrix function.

The last step is just transposing the matrix and printing it.


答:
Swift 3, 55 bytes

Dependency: Foundation for pow(73 bytes if you count import statement)

stride(from:0,to:pow(10,100),by:1).map{_ in print(1)}

I know there is another answer above. However, pow(10,100.0) generates error message: fatal error: Double value cannot be converted to Int because the result would be greater than Int.max, and it also requires Foundation as well

Title: Output a googol copies of a string

Body:
I am interested in seeing programs which don't ask for any input, print a googol copies of some nonempty string, no less, no more, and then stop. A googol is defined as \$10^{100}\$, i.e., 1 followed by a hundred 0's in decimal.

Example output:

```<code>111111111111111111111111111111111111111111111111111111111111111111111111...
</code>```

or

```<code>Hello world
Hello world
Hello world
Hello world
Hello world
Hello world
...
</code>```

The string can also be entirely composed of white space or special symbols. The only exception to identical copies of a fixed string is if your language decorates the output in some way that can not be prevented, but could be trivially undone in a wrapper script, like prepending a line number to each line. The wrapper script in such cases need not be provided.

You can assume your computer will never run out of time, but other than that, your program must have a reasonable demand of resources. Also, you must respect any restrictions that the programming language of your choice poses, for example, you can not exceed a maximum value allowed for its integer types, and at no point more than 4 GB of memory must be needed.

In other words, the program should in principle be testable by running it on your computer. But because of the extent of this number you will be expected to prove that the number of copies of the string it outputs is exactly 10^100 and that the program stops afterwards. Stopping can be exiting or halting or even terminating due to an error, but if so, the error must not produce any output that could not easily be separated from the program's output.

This is code-golf,  so the solution with the fewest bytes wins.

Example solution (C, ungolfed, 3768 bytes)

```<code>#include <stdio.h>

int main() {
  int a00, a01, a02, a03, ..., a99;
  for(a00 = 0; a00 < 10; a00++)
  for(a01 = 0; a01 < 10; a01++)
  for(a02 = 0; a02 < 10; a02++)
  for(a03 = 0; a03 < 10; a03++)
  ...
  for(a99 = 0; a99 < 10; a99++)
    puts("1");
  return 0;
}
</code>```


答:
Swift 3, 51

Dependency: Foundation for String(format:_:)

{$0.utf8.map{String(format:"%02d",$0-96)}.joined()} // where $0 is String

Usage:

Test

"codegolf".utf8.map{String(format:"%02d",$0-96)}.joined()

or

{$0.utf8.map{String(format:"%02d",$0-96)}.joined()}("codegolf")

Title: Encode the alphabet cipher

Body:
Given a string that contains only lowercase letters, encode that string with the alphabet cipher.

To encode with the alphabet cipher (I will be using the example hello):

First, convert each letter in the string to a number depending on its position in the alphabet (a = 1, b = 2, etc.) Example: 8 5 12 12 15

Pad each number to two characters with 0s. Example: 08 05 12 12 15

Join. Example: 0805121215

Test cases

```<code>helloworld -> 08051212152315181204
codegolf -> 0315040507151206
alphabetcipher -> 0112160801020520030916080518
johncena -> 1015081403051401
</code>```

Remember, this is code-golf, so the code with the fewest number of bytes wins.


问:
Capture on the Pawn Chessboard
You should write a program or function which receives a string representing a chessboard with only pawns as input and outputs or returns whether any capture is possible on the board.

Input is in a FEN-like notation describing positions of white and black pawns with no other pieces present. You should decide if there is a pawn which can capture an enemy one.

Each rank is described, starting with rank 8 and ending with rank 1; within each rank, the contents of each square are described from file "a" through file "h". Each pawn is identified by a single letter (white pawn = "P", black pawn = "p", ). Empty squares are noted using digits 1 through 8 (the number of empty squares), and "/" separates ranks. (partially taken from Wikipedia)

For example

```<code>8/pppppppp/8/8/4P3/8/PPPP1PPP/8
</code>```

describes the board

```<code>--------

pppppppp

    P

PPPP PPP

--------
</code>```

A white pawn can capture a black one if the black one is positioned diagonally up from it (black is up-left or up-right) and a black pawn can capture a white one if the white one is diagonally below from it (white is down-left or down-right). No other capture move (en passant) should be considered.

Input

A FEN-like string consisting of the characters 12345678pP/.

The input describes the pawns of a valid chess game position. This means (among other more complex constraints) there will be at most 8 pawns for each side and no pawns on ranks 1 and 8.

Output

If there is a possible capture for either side you should output a truthy value and a falsy value otherwise.

Examples

Inputs with truthy output (one per line)

```<code>8/7p/6P1/8/8/8/8/8
8/8/p7/1P6/3P3p/8/8/8
8/2P5/8/4P1p1/2p2P2/3p4/3p1P2/8
8/P7/8/5P2/2pp4/3P2p1/3pP3/8
8/P7/p7/p1P1P3/1P3p2/8/1p6/8
8/4p1P1/2P2P1P/2p1pPpp/8/6P1/pP1p4/8
</code>```

Inputs with falsy output (one per line)

```<code>8/8/8/8/8/8/8/8
8/7P/6p1/8/8/8/8/8
8/7p/7P/8/8/8/8/8
8/pppppppp/8/8/8/8/PPPPPPPP/8
8/p7/8/1p6/5P2/8/8/8
8/p7/P7/2P1p1p1/2p5/8/PP6/8
</code>```

This is code golf so the shortest entry wins.

答:
PHP, <s>94</s> <s>87</s> 80 bytes

```<code>for(;$i++<8;)$t[$i]=$s.=" ";echo preg_match("#p.{7}(..)?P#",strtr($argv[1],$t));
</code>```

That loop+strtr is a lot shorter than preg_replace_callback with str_pad.

Title: Capture on the Pawn Chessboard

Body:
PHP, <s>94</s> <s>87</s> 80 bytes

for(;$i++<8;)$t[$i]=$s.=" ";echo preg_match("#p.{7}(..)?P#",strtr($argv[1],$t));

That loop+strtr is a lot shorter than preg_replace_callback with str_pad.


问:
Play the "bzzt" game

Winner: Aditsu's CJam answer! A whopping 25 bytes! Nice!

You may continue to submit your answer, however you can no longer win. Original post kept for posterity:

The "Bzzt" game is a game where you must count to a number (in this case 500). However, if the number has a 3 in it, or is divisible by 3, you don't say the number. Instead, you say "Bzzt".

Rules:

You can't hard-code the numbers.

The number only has to satisfy at least 1 of the following requirements

Divisible by 3

Number contains a 3

Some type of separator is mandatory (12bzzt14 doesn't count)

Score is measured in bytes.

You must count exactly to 500, starting at 1 or 0 (you chose).

The numbers must be output, but it doesn't matter how (e.g., stdout, writing to a text file, etc.).

0 can be divisible by 3 or not divisible. You can choose.

You can output the numbers one at a time (ex, output 1, then 2, then bzzt, then 4, etc) or all at once (e.g., output 1 2 bzzt 4 5).

You must replace the letter 3 with the word "bzzt". This is not case sensitive (bZzt, Bzzt, bzzt are all okay).

This is a code-golf challenge, so the shortest code wins.

This contest ends June 30th 2014 (7 days from posting).

Title: Play the "bzzt" game

Body:
Swift 3, 62

(0...500).map{print($0%3<1||"\($0)".contains("3") ?"bzzt":$0)}

or

for n in 0...500{print(n%3<1||"\(n)".contains("3") ?"bzzt":n)}


问:
Simple cat program
One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after the Unix shell utility cat it is of course much less powerful than the real thing, which is normally used to print (and concatenate) several files read from disc.

Task

You should write a full program which reads the contents of the standard input stream and writes them verbatim to the standard output stream. If and only if your language does not support standard input and/or output streams (as understood in most languages), you may instead take these terms to mean their closest equivalent in your language (e.g. JavaScript's prompt and alert). These are the only admissible forms of I/O, as any other interface would largely change the nature of the task and make answers much less comparable.

The output should contain exactly the input and nothing else. The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation. This also applies to trailing newlines. If the input does not contain a trailing newline, the output shouldn't include one either! (The only exception being if your language absolutely always prints a trailing newline after execution.)

Output to the standard error stream is ignored, so long as the standard output stream contains the expected output. In particular, this means your program can terminate with an error upon hitting the end of the stream (EOF), provided that doesn't pollute the standard output stream. If you do this, I encourage you to add an error-free version to your answer as well (for reference).

As this is intended as a challenge within each language and not between languages, there are a few language specific rules:

If it is at all possible in your language to distinguish null bytes in the standard input stream from the EOF, your program must support null bytes like any other bytes (that is, they have to be written to the standard output stream as well).

If it is at all possible in your language to support an arbitrary infinite input stream (i.e. if you can start printing bytes to the output before you hit EOF in the input), your program has to work correctly in this case. As an example yes | tr -d \\n | ./my_cat should print an infinite stream of ys. It is up to you how often you print and flush the standard output stream, but it must be guaranteed to happen after a finite amount of time, regardless of the stream (this means, in particular, that you cannot wait for a specific character like a linefeed before printing).

Please add a note to your answer about the exact behaviour regarding null-bytes, infinite streams, and extraneous output.

Additional rules

This is not about finding the language with the shortest solution for this (there are some where the empty program does the trick) - this is about finding the shortest solution in every language. Therefore, no answer will be marked as accepted.

Submissions in most languages will be scored in bytes in an appropriate preexisting encoding, usually (but not necessarily) UTF-8.

Some languages, like Folders, are a bit tricky to score. If in doubt, please ask on Meta.

Feel free to use a language (or language version) even if it's newer than this challenge. Languages specifically written to submit a 0-byte answer to this challenge are fair game but not particularly interesting.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Also note that languages do have to fulfil our usual criteria for programming languages.

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck derivatives like Headsecks or Unary), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

Unless they have been overruled earlier, all standard code-golf rules apply, including the http://meta.codegolf.stackexchange.com/q/1061.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf; these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the author actually had to put effort into golfing the code.

Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Gaot++, 113 bytes

```<code>bleeeet bleeeeeet bleeeeeeeeeeeet bleeeet b bleeeeeeeeeeeeet bleeeet b bleeeeeeet bleeeet bleeeeeeeeeet bleeeeeet
</code>```

In Compressed Gaot++ it's 25 bytes:

```<code>4e6e12e4eb13e4eb7e4e10e6e
</code>```

Cannot terminate on the offline interpreter, EOF is  not recognized by the language :(

Online interpreter for both normal and compressed versions.

Title: Simple cat program

Body:
Gaot++, 113 bytes

bleeeet bleeeeeet bleeeeeeeeeeeet bleeeet b bleeeeeeeeeeeeet bleeeet b bleeeeeeet bleeeet bleeeeeeeeeet bleeeeeet

In Compressed Gaot++ it's 25 bytes:

4e6e12e4eb13e4eb7e4e10e6e

Cannot terminate on the offline interpreter, EOF is  not recognized by the language :(

Online interpreter for both normal and compressed versions.


问:
Find the Wavy Words!
(Note: this is an easier spin-off of my previous challenge Find the Infinity Words!, which is a spin-off of my other previous challenge Find the Swirling Words! :) )

Definition of a Wavy Word:

If you connect with curves all the characters of a Wavy Word on the alphabet (A-Z) you obtain the path of a wave continuously going toward right or toward left and never changing direction, like in the diagrams below.

A Wavy Word can be:

Raising if each consecutive character is at the right (on the alphabet) of the previous one.

Decreasing if each consecutive character is at the left (on the alphabet) of the previous one.

All the even connection must be down, all the odd connections must be up.

You can ignore upper/lowercase or consider/convert all to upper case or all to lower case.

The input words are only characters in the alphabet range of A-Z, no spaces, no punctuation, or symbols.

If a word has double characters, like "SPOON", you must collapse the doubles to one character: "SPOON" > "SPON" (because if you go from O to O is zero distance).

The Wavy Words will contain at least 3 distinct characters (even after doubles collapsing).

Here there are some examples:

Task:

Write a full program or function that will take a word from standard input and will output if it is a Wavy Word or not, and in positive case, output if it is raising or decreasing. The output can be True/False/Null, 2/1/0, 1/Null/0, -1/0/1, NO/WR/WD, etc, you decide how to represent it.

Test cases:

```<code>WAVY WORDS:
  ADEPT, BEGIN, BILL, BOSS, BOOST, CHIMP,
  KNOW, SPONGE, SPOON, TROLL, WOLF

ADEPT  > YES > RAISING
BEGIN  > YES > RAISING
BILL   > YES > RAISING
BOSS   > YES > RAISING
BOOST  > YES > RAISING
CHIMP  > YES > RAISING
KNOW   > YES > RAISING
SPONGE > YES > DECREASING
SPOON  > YES > DECREASING
TROLL  > YES > DECREASING
WOLF   > YES > DECREASING

NOT WAVY WORDS:
  WATCH, EARTH, NINON, FOO, BAR, WAVE, SELECTION,
  YES, NO, DEFINITION, WATER, WINE, CODE, AAAHHHH, I, MM, ABCA
</code>```

Rules:

Shortest code wins.

Optional Task:

Find, as a list, as many Wavy Words as you can in an English dictionary, and the longest as well. You can take for example as reference the complete list of English words here.

答:
R, 96 95 bytes

```<code>function(x,d=diff(rle(utf8ToInt(x))$v))if(any(d>0)&any(d<0)|sum(1|d)<2)3 else`if`(all(d<1),2,1)
</code>```

Returns:

1 for wavy and raising

2 for wavy and decreasing

3 for non-wavy

Explained

d=diff(rle(utf8ToInt(x))$v): Generates a variable d by first converting the string into it's ASCII values using utf8ToInt which conveniently returns a vector. Subsequently perform run length encoding using rle. rle(...)$v returns the non-repeating values of the sequence (i.e. collapsing all runs). Finally take the difference.

if(any(d>0)&any(d<0)|sum(1|d)<2)3: If at least one of the differences are positive and at least one negative, or if the difference sequence has less than 2 elements (equivalent to the original word having less than 3 characters), the word is non-wavy and return 3

else``if``(all(d<1),2,1): Else if all differences are negative, return 2 for wavy and decreasing, else return 1 for wavy and raising.

Try all the test cases at R-fiddle (note that it's named such that it can be vectorized for the test cases).

Title: Find the Wavy Words!

Body:
R, 96 95 bytes

function(x,d=diff(rle(utf8ToInt(x))$v))if(any(d>0)&any(d<0)|sum(1|d)<2)3 else`if`(all(d<1),2,1)

Returns:

1 for wavy and raising

2 for wavy and decreasing

3 for non-wavy

Explained

d=diff(rle(utf8ToInt(x))$v): Generates a variable d by first converting the string into it's ASCII values using utf8ToInt which conveniently returns a vector. Subsequently perform run length encoding using rle. rle(...)$v returns the non-repeating values of the sequence (i.e. collapsing all runs). Finally take the difference.

if(any(d>0)&any(d<0)|sum(1|d)<2)3: If at least one of the differences are positive and at least one negative, or if the difference sequence has less than 2 elements (equivalent to the original word having less than 3 characters), the word is non-wavy and return 3

else``if``(all(d<1),2,1): Else if all differences are negative, return 2 for wavy and decreasing, else return 1 for wavy and raising.

Try all the test cases at R-fiddle (note that it's named such that it can be vectorized for the test cases).


答:
Commodore VIC 20 machine code (40 bytes)

... here shown as hexadecimal:

```<code>1040   A9[64]A2 00 9D 68 10 E8  E0[32]D0 F8 A9 00 9D 68
1050   10 A9[31]20 D2 FF A2 00  A9[64]DE 68 10 30 08 D0
1060   F0 9D 68 10 E8 D0 F3 60
</code>```

(Started using: SYS 4160)

Meaning of the bytes in brackets

0x64 (occurs twice) is the base (100); (values from 2 to 127 should work)

0x32 is the exponent (50) (any non-zero value (1-255) should work)

Note that 100^50 = 10^100; running the program 100^50 times is more RAM efficient than doing it 10^100 times

0x31 is the ASCII character to be printed

and at no point no more than 4 GB of memory must be needed.

Is this a typing mistake?

We have the year 1981.

A typical home computer has 1 to 16 KB of RAM! And you will hardly find professional models that have 1 MB or more.

(Ok. Just a joke.)

In other words, the program should in principle be testable by running it on your computer. But because of the extent of this number you will be expected to prove that the number of copies of the string it outputs is exactly 10^100 and that the program stops afterwards.

The program has been tested with other bases and exponents. I have no doubt it will also work with 100 and 50.

At least it does not crash with these numbers (but does not terminate in measurable time either).

The memory size is sufficient for an exponent of 50 and 100 is less than 127 so a base of 100 should not be a problem.

The the basic idea

There is a 50-digit counter that counts in the 100-system. Bytes 0x01-0x64 represent the digits 0-99. The first byte in the counter is the lowest digit. The last byte in the counter (highest digit) is followed by a byte with the value 0x00.

The counter has the initial value 100^50.

An outer loop is writing a byte to the "current channel" ("standard output" on modern systems; typically the screen) and then decrements the counter.

Decrementing is done by an inner loop: It decrements a digit and in the case of an underflow from 1 to 99 it advances to the next digit. If the byte 0x00 at the end of the counter is decremented the program stops.

The assembly code is

```<code>    ; Some constants
    base=10
    exponent=100
    character=0x32

    ; Initialize the content of the counter to 100^50
    ; (Fill the first 50 bytes with the value 100)
    lda  #base
    ldx  #0
initLoop:
    sta  counter,x
    inx
    cpx  #exponent
    bne  initLoop
    ; (The terminating 0 at the end of the counter)
    lda  #0
    sta  counter,x

    ; Now do the actual job
outerLoop:
    ; Output a character
    lda  #character
    jsr  (0xFFD2)
    ; Prepare for the inner loop
    ldx  #0
    lda  #base
innerLoop:
    ; Decrement one digit
    dec  counter,x
    ; Result is negative -> must have been the terminating
    ; NUL byte -> Exit
    bmi  progEnd
    ; Result is not zero -> Print the next byte
    bne  outerLoop
    ; Result is zero -> Was 0x01 before -> As 0x01 represents
    ; digit 0 this is an underflow -> set the digit to
    ; "exponent" (100) again (which represents digit 99)
    sta  counter,x
    ; Go to the next digit and...
    inx
    ; ... repeat the inner loop (decrement next digit)
    ; (Note that this conditional branch is ALWAYS taken)
    bne  innerLoop

progEnd:
    rts

counter:
    ; The memory used by the counter is here...
</code>```

EDIT

The program runs on Commodore C64, too!

Title: Output a googol copies of a string

Body:
Commodore VIC 20 machine code (40 bytes)

... here shown as hexadecimal:

1040   A9[64]A2 00 9D 68 10 E8  E0[32]D0 F8 A9 00 9D 68
1050   10 A9[31]20 D2 FF A2 00  A9[64]DE 68 10 30 08 D0
1060   F0 9D 68 10 E8 D0 F3 60

(Started using: SYS 4160)

Meaning of the bytes in brackets

0x64 (occurs twice) is the base (100); (values from 2 to 127 should work)

0x32 is the exponent (50) (any non-zero value (1-255) should work)

Note that 100^50 = 10^100; running the program 100^50 times is more RAM efficient than doing it 10^100 times

0x31 is the ASCII character to be printed

and at no point no more than 4 GB of memory must be needed.

Is this a typing mistake?

We have the year 1981.

A typical home computer has 1 to 16 KB of RAM! And you will hardly find professional models that have 1 MB or more.

(Ok. Just a joke.)

In other words, the program should in principle be testable by running it on your computer. But because of the extent of this number you will be expected to prove that the number of copies of the string it outputs is exactly 10^100 and that the program stops afterwards.

The program has been tested with other bases and exponents. I have no doubt it will also work with 100 and 50.

At least it does not crash with these numbers (but does not terminate in measurable time either).

The memory size is sufficient for an exponent of 50 and 100 is less than 127 so a base of 100 should not be a problem.

The the basic idea

There is a 50-digit counter that counts in the 100-system. Bytes 0x01-0x64 represent the digits 0-99. The first byte in the counter is the lowest digit. The last byte in the counter (highest digit) is followed by a byte with the value 0x00.

The counter has the initial value 100^50.

An outer loop is writing a byte to the "current channel" ("standard output" on modern systems; typically the screen) and then decrements the counter.

Decrementing is done by an inner loop: It decrements a digit and in the case of an underflow from 1 to 99 it advances to the next digit. If the byte 0x00 at the end of the counter is decremented the program stops.

The assembly code is

    ; Some constants
    base=10
    exponent=100
    character=0x32

    ; Initialize the content of the counter to 100^50
    ; (Fill the first 50 bytes with the value 100)
    lda  #base
    ldx  #0
initLoop:
    sta  counter,x
    inx
    cpx  #exponent
    bne  initLoop
    ; (The terminating 0 at the end of the counter)
    lda  #0
    sta  counter,x

    ; Now do the actual job
outerLoop:
    ; Output a character
    lda  #character
    jsr  (0xFFD2)
    ; Prepare for the inner loop
    ldx  #0
    lda  #base
innerLoop:
    ; Decrement one digit
    dec  counter,x
    ; Result is negative -> must have been the terminating
    ; NUL byte -> Exit
    bmi  progEnd
    ; Result is not zero -> Print the next byte
    bne  outerLoop
    ; Result is zero -> Was 0x01 before -> As 0x01 represents
    ; digit 0 this is an underflow -> set the digit to
    ; "exponent" (100) again (which represents digit 99)
    sta  counter,x
    ; Go to the next digit and...
    inx
    ; ... repeat the inner loop (decrement next digit)
    ; (Note that this conditional branch is ALWAYS taken)
    bne  innerLoop

progEnd:
    rts

counter:
    ; The memory used by the counter is here...

EDIT

The program runs on Commodore C64, too!


答:
Charcoal, 9 bytes

Note that Charcoal uses a custom codepage.

```<code>ＦＸ¹⁰¦¹⁰⁰Ｄ
</code>```

Prints one googol newlines. Takes around 3.16887646×10⁹⁰ years to finish running.

Explanation

```<code>Ｆ        For
 Ｘ       Exponentiate
  ¹⁰¦¹⁰⁰  10, 100
Ｄ        Print (Dump) contents of canvas ("") plus newline
</code>```

This will not freeze your computer (luckily!) because Charcoal has a 10ms minimum delay between prints by default. Charcoal used range as of this challenge's posting, therefore using more than 4GB of memory, but this has been fixed.

Title: Output a googol copies of a string

Body:
Charcoal, 9 bytes

Note that Charcoal uses a custom codepage.

ＦＸ¹⁰¦¹⁰⁰Ｄ

Prints one googol newlines. Takes around 3.16887646×10⁹⁰ years to finish running.

Explanation

Ｆ        For
 Ｘ       Exponentiate
  ¹⁰¦¹⁰⁰  10, 100
Ｄ        Print (Dump) contents of canvas ("") plus newline

This will not freeze your computer (luckily!) because Charcoal has a 10ms minimum delay between prints by default. Charcoal used range as of this challenge's posting, therefore using more than 4GB of memory, but this has been fixed.


答:
PHP, 44 bytes

```<code>for($i=bcpow(10,1e2);$i=bcsub($i,print 1););
</code>```

This snippet will output 1 googol times. It will not run out of memory, but it is terribly slow. I'm using BCMath to be able to handle long integers.

A bit better performing, but not as small (74 bytes):

```<code>for($m=bcpow(10,100);$m;$m=bcsub($m,$a))echo str_repeat(a,$a=min(4e9,$m));
</code>```

Will output the letter a googol times. It will consume almost 4GB of memory, outputting about 4e9 characters at a time.

Title: Output a googol copies of a string

Body:
PHP, 44 bytes

for($i=bcpow(10,1e2);$i=bcsub($i,print 1););

This snippet will output 1 googol times. It will not run out of memory, but it is terribly slow. I'm using BCMath to be able to handle long integers.

A bit better performing, but not as small (74 bytes):

for($m=bcpow(10,100);$m;$m=bcsub($m,$a))echo str_repeat(a,$a=min(4e9,$m));

Will output the letter a googol times. It will consume almost 4GB of memory, outputting about 4e9 characters at a time.


答:
05AB1E, <s>26</s> <s>23</s> 21 bytes (non-competing)

```<code>501FND3ÖN3å~i"bzzt"},
</code>```

Try it online!

Title: Play the "bzzt" game

Body:
Winner: Aditsu's CJam answer! A whopping 25 bytes! Nice!

You may continue to submit your answer, however you can no longer win. Original post kept for posterity:

The "Bzzt" game is a game where you must count to a number (in this case 500). However, if the number has a 3 in it, or is divisible by 3, you don't say the number. Instead, you say "Bzzt".

Rules:

You can't hard-code the numbers.

The number only has to satisfy at least 1 of the following requirements

Divisible by 3

Number contains a 3

Some type of separator is mandatory (12bzzt14 doesn't count)

Score is measured in bytes.

You must count exactly to 500, starting at 1 or 0 (you chose).

The numbers must be output, but it doesn't matter how (e.g., stdout, writing to a text file, etc.).

0 can be divisible by 3 or not divisible. You can choose.

You can output the numbers one at a time (ex, output 1, then 2, then bzzt, then 4, etc) or all at once (e.g., output 1 2 bzzt 4 5).

You must replace the letter 3 with the word "bzzt". This is not case sensitive (bZzt, Bzzt, bzzt are all okay).

This is a code-golf challenge, so the shortest code wins.

This contest ends June 30th 2014 (7 days from posting).

Body:
05AB1E, <s>26</s> <s>23</s> 21 bytes (non-competing)

501FND3ÖN3å~i"bzzt"},

Try it online!


Title: Encode the alphabet cipher

Body:
C#, 54 bytes

s=>String.Join("",s.Select(n=>(n<106?"0":"")+(n-96)));


答:
C#, 161 bytes

I am so sorry.

```<code>(s,i)=>String.Join("",Enumerable.Range(0,i).SelectMany(x=>Enumerable.Range(0,s.Length/i+1).Select(n=>(n*3+x)).Where(m=>m<s.Length).Select(o=>s.Substring(o,1))));
</code>```

Title: Encode the column cipher

Body:
Given a string to encode, and a number of columns (the key), encode the string as follows:

I will be using the example Hello, world! and the key 3

First, write out the number of columns:

```<code>1 2 3
</code>```

Next, write the text starting from the upper left, one character per column, and when you run out of columns, go to the next line.

```<code>1 2 3
H e l
l o ,
  w o
r l d
!
</code>```

Now, to get your encoded text, read the text starting from the top left corner, but this time, first read one column, and then the next, and so on. If there is not a character in the slot, put a space.

```<code>Hl r!eowl l,od
</code>```

Note that here, there is a trailing space.

This is your encoded text.

Another test case is Programming Puzzles and Code Golf SE with key 5:

```<code>1 2 3 4 5
P r o g r
a m m i n
g   P u z
z l e s
a n d   C
o d e   G
o l f   S
E
</code>```

The encoded text is PagzaooErm lndl omPedef gius    rnz CGS.

More test cases

```<code>"abcdefghijklmnopqrstuvwxyz", 2 -> "acegikmoqsuwybdfhjlnprtvxz"
"codegolf.stackexchange.com", 4 -> "cg.ccgoooskhemdltea. efaxnc "
"Pen Pineapple Apple Pen!!!", 7 -> "PeAeeapnnpp! pl!Ple!ie  n P "
"1,1,2,3,5,8,13,21,34,55,89", 10 -> "18,,,5115,3,2,8,2931 ,, 53 ,4 "
</code>```

Remember, this is code-golf, so the code with the fewest bytes wins.

Body:
C#, 161 bytes

I am so sorry.

(s,i)=>String.Join("",Enumerable.Range(0,i).SelectMany(x=>Enumerable.Range(0,s.Length/i+1).Select(n=>(n*3+x)).Where(m=>m<s.Length).Select(o=>s.Substring(o,1))));


答:
RPython 5.4.1, n ≈ 32 (37 seconds)

from rpython.rlib.rtime import time
from rpython.rlib.rarithmetic import r_int, r_uint
from rpython.rlib.rrandom import Random
from rpython.rlib.rposix import pipe, close, read, write, fork, waitpid
from rpython.rlib.rbigint import rbigint

from math import log, ceil
from struct import pack

bitsize = len(pack('l', 1)) * 8 - 1

bitcounts = bytearray([0])
for i in range(16):
  b = bytearray([j+1 for j in bitcounts])
  bitcounts += b

def bitcount(n):
  bits = 0
  while n:
    bits += bitcounts[n & 65535]
    n >>= 16
  return bits

def main(argv):
  if len(argv) < 2:
    write(2, 'Usage: %s NUM_THREADS [N]'%argv[0])
    return 1
  threads = int(argv[1])

  if len(argv) > 2:
    n = int(argv[2])
    rnd = Random(r_uint(time()*1000))
    m = []
    for i in range(n):
      row = []
      for j in range(n):
        row.append(1 - r_int(rnd.genrand32() & 2))
      m.append(row)
  else:
    m = []
    strm = ""
    while True:
      buf = read(0, 4096)
      if len(buf) == 0:
        break
      strm += buf
    rows = strm.split("\n")
    for row in rows:
      r = []
      for val in row.split(' '):
        r.append(int(val))
      m.append(r)
    n = len(m)

  a = []
  for row in m:
    val = 0
    for v in row:
      val = (val << 1) | -(v >> 1)
    a.append(val)

  batches = int(ceil(n * log(n) / (bitsize * log(2))))

  pids = []
  handles = []
  total = rbigint.fromint(0)
  for i in range(threads):
    r, w = pipe()
    pid = fork()
    if pid:
      close(w)
      pids.append(pid)
      handles.append(r)
    else:
      close(r)
      total = run(n, a, i, threads, batches)
      write(w, total.str())
      close(w)
      return 0

  for pid in pids:
    waitpid(pid, 0)

  for handle in handles:
    strval = read(handle, 256)
    total = total.add(rbigint.fromdecimalstr(strval))
    close(handle)

  print total.rshift(n-1).str()

  return 0

def run(n, a, mynum, threads, batches):
  start = (1 << n-1) * mynum / threads
  end = (1 << n-1) * (mynum+1) / threads

  dtotal = rbigint.fromint(0)
  for delta in range(start, end):
    pdelta = rbigint.fromint(1 - ((bitcount(delta) & 1) << 1))
    for i in range(batches):
      pbatch = 1
      for j in range(i, n, batches):
        pbatch *= n - (bitcount(delta ^ a[j]) << 1)
      pdelta = pdelta.int_mul(pbatch)
    dtotal = dtotal.add(pdelta)

  return dtotal

def target(*args):
  return main
```
<p>To compile, download the most recent PyPy source, and execute the following:</p>
<pre class="lang-python prettyprint-override"><code>pypy /path/to/pypy-src/rpython/bin/rpython matrix-permanent.py
</code>```

The resulting executable will be named matrix-permanent-c or similiar in the current working directory.

As of PyPy 5.0, RPython's threading primitives are a lot less primitive than they used to be. Newly spawned threads require the GIL, which is more or less useless for parallel computations. I've used fork instead, so it may not work as expected on Windows, <s>although I haven't tested</s> fails to compile (unresolved external symbol _fork).

The executable accepts up to two command line parameters. The first is the number of threads, the second optional parameter is n. If it is provided, a random matrix will be generated, otherwise it will be read from stdin. Each row must be newline separated (without a trailing newline), and each value space separated. The third example input would be given as:

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 -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 -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 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 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 -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 -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 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 -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 -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 -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 -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 -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 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 -1 1
-1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 -1 -1
```
<hr />
<p><strong>Sample Usage</strong></p>
<pre class="lang-python prettyprint-override"><code>$ time ./matrix-permanent-c 8 30
8395059644858368

real    0m8.582s
user    1m8.656s
sys     0m0.000s
</code>```

Method

I've used the Balasubramanian-Bax/Franklin-Glynn formula, with a runtime complexity of O(2nn). However, instead of iterating the δ in grey code order, I've instead replaced vector-row multiplication with a single xor operation (mapping (1, -1) → (0, 1)). The vector sum can likewise be found in a single operation, by taking n minus twice the popcount.

Title: Calculate the permanent as quickly as possible

Body:
The challenge is to write the fastest code possible for computing the permanent of a matrix.

The permanent of an n-by-n matrix A = (ai,j) is defined as

Here S_n represents the set of all permutations of [1, n].

As an example (from the wiki):

In this question matrices are all square and will only have the values -1 and 1 in them.

Examples

Input:

```<code>[[ 1 -1 -1  1]
 [-1 -1 -1  1]
 [-1  1 -1  1]
 [ 1 -1 -1  1]]
</code>```

Permanent:

```<code>-4
</code>```

Input:

```<code>[[-1 -1 -1 -1]
 [-1  1 -1 -1]
 [ 1 -1 -1 -1]
 [ 1 -1  1 -1]]
</code>```

Permanent:

```<code>0
</code>```

Input:

```<code>[[ 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  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  1 -1]
 [-1 -1  1 -1  1  1  1  1]]
</code>```

Permanent:

```<code>192
</code>```

Input:

```<code>[[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, -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, -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, 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, 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, -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, -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, 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, -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, -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, -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, -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, -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, 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, -1, 1],
 [-1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1]]
</code>```

Permanent:

```<code>1021509632
</code>```

The task

You should write code that, given an n by n matrix, outputs its permanent.

As I will need to test your code it would be helpful if you could give a simple way for me to give a matrix as input to your code, for example by reading from standard in.

Be warned that the permanent can be large (the all 1s matrix is the extreme case).

Scores and ties

I will test your code on random +-1 matrices of increasing size and stop the first time your code takes more than 1 minute on my computer.  The scoring matrices will be consistent for all submissions in order to ensure fairness.

If two people get the same score then the winner is the one which is fastest for that value of n. If those are within 1 second of each other then it is the one posted first.

Languages and libraries

You can use any available language and libraries you like but no pre-existing function to compute the permanent. Where feasible, it would be good to be able to run your code so please include a full explanation for how to run/compile your code in Linux if at all possible.`

Reference implementations

There is already a codegolf question question with lots of code in different languages for computing the permanent for small matrices. Mathematica and Maple also both have permanent implementations if you can access those.

My Machine The timings will be run on my 64-bit machine. This is a standard ubuntu install with 8GB RAM, AMD FX-8350 Eight-Core Processor and Radeon HD 4250.  This also means I need to be able to run your code.

Low level information about my machine

cat /proc/cpuinfo/|grep flags gives

flags     : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
  pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt
  pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid
  aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt
  aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a
  misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce
  nodeid_msr tbm topoext perfctr_core perfctr_nb cpb hw_pstate vmmcall
  bmi1 arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid
  decodeassists pausefilter pfthreshold

I will ask a closely related follow up multi-language question that doesn't suffer from the big Int problem so lovers of Scala, Nim, Julia, Rust, Bash can show off their languages too.

Leader board

n = 33 (45 seconds. 64 seconds for n = 34). Ton Hospel in C++ with g++ 5.4.0.

n = 32 (32 seconds). Dennis in C with gcc 5.4.0 using Ton Hospel's gcc flags.

n = 31 (54 seconds). Christian Sievers in Haskell

n = 31 (60 seconds). primo in rpython

n = 30 (26 seconds). ezrast in Rust

n = 28 (49 seconds). xnor with Python + pypy 5.4.1

n = 22 (25 seconds). Shebang with Python + pypy 5.4.1

Note. In practice the timings for Dennis and Ton Hospel's vary a lot for mysterious reasons. For example they seem to be faster after I have loaded a web browser! The timings quoted are the fastest in all the tests I have done.

Body:
RPython 5.4.1, n ≈ 32 (37 seconds)

from rpython.rlib.rtime import time
from rpython.rlib.rarithmetic import r_int, r_uint
from rpython.rlib.rrandom import Random
from rpython.rlib.rposix import pipe, close, read, write, fork, waitpid
from rpython.rlib.rbigint import rbigint

from math import log, ceil
from struct import pack

bitsize = len(pack('l', 1)) * 8 - 1

bitcounts = bytearray([0])
for i in range(16):
  b = bytearray([j+1 for j in bitcounts])
  bitcounts += b

def bitcount(n):
  bits = 0
  while n:
    bits += bitcounts[n & 65535]
    n >>= 16
  return bits

def main(argv):
  if len(argv) < 2:
    write(2, 'Usage: %s NUM_THREADS [N]'%argv[0])
    return 1
  threads = int(argv[1])

  if len(argv) > 2:
    n = int(argv[2])
    rnd = Random(r_uint(time()*1000))
    m = []
    for i in range(n):
      row = []
      for j in range(n):
        row.append(1 - r_int(rnd.genrand32() & 2))
      m.append(row)
  else:
    m = []
    strm = ""
    while True:
      buf = read(0, 4096)
      if len(buf) == 0:
        break
      strm += buf
    rows = strm.split("\n")
    for row in rows:
      r = []
      for val in row.split(' '):
        r.append(int(val))
      m.append(r)
    n = len(m)

  a = []
  for row in m:
    val = 0
    for v in row:
      val = (val << 1) | -(v >> 1)
    a.append(val)

  batches = int(ceil(n * log(n) / (bitsize * log(2))))

  pids = []
  handles = []
  total = rbigint.fromint(0)
  for i in range(threads):
    r, w = pipe()
    pid = fork()
    if pid:
      close(w)
      pids.append(pid)
      handles.append(r)
    else:
      close(r)
      total = run(n, a, i, threads, batches)
      write(w, total.str())
      close(w)
      return 0

  for pid in pids:
    waitpid(pid, 0)

  for handle in handles:
    strval = read(handle, 256)
    total = total.add(rbigint.fromdecimalstr(strval))
    close(handle)

  print total.rshift(n-1).str()

  return 0

def run(n, a, mynum, threads, batches):
  start = (1 << n-1) * mynum / threads
  end = (1 << n-1) * (mynum+1) / threads

  dtotal = rbigint.fromint(0)
  for delta in range(start, end):
    pdelta = rbigint.fromint(1 - ((bitcount(delta) & 1) << 1))
    for i in range(batches):
      pbatch = 1
      for j in range(i, n, batches):
        pbatch *= n - (bitcount(delta ^ a[j]) << 1)
      pdelta = pdelta.int_mul(pbatch)
    dtotal = dtotal.add(pdelta)

  return dtotal

def target(*args):
  return main

To compile, download the most recent PyPy source, and execute the following:

pypy /path/to/pypy-src/rpython/bin/rpython matrix-permanent.py

The resulting executable will be named matrix-permanent-c or similiar in the current working directory.

As of PyPy 5.0, RPython's threading primitives are a lot less primitive than they used to be. Newly spawned threads require the GIL, which is more or less useless for parallel computations. I've used fork instead, so it may not work as expected on Windows, <s>although I haven't tested</s> fails to compile (unresolved external symbol _fork).

The executable accepts up to two command line parameters. The first is the number of threads, the second optional parameter is n. If it is provided, a random matrix will be generated, otherwise it will be read from stdin. Each row must be newline separated (without a trailing newline), and each value space separated. The third example input would be given as:

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 -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 -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 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 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 -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 -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 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 -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 -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 -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 -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 -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 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 -1 1
-1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 -1 -1

Sample Usage

$ time ./matrix-permanent-c 8 30
8395059644858368

real    0m8.582s
user    1m8.656s
sys     0m0.000s

Method

I've used the Balasubramanian-Bax/Franklin-Glynn formula, with a runtime complexity of O(2nn). However, instead of iterating the δ in grey code order, I've instead replaced vector-row multiplication with a single xor operation (mapping (1, -1) → (0, 1)). The vector sum can likewise be found in a single operation, by taking n minus twice the popcount.


答:
DASH, 27 bytes

```<code>@><""(->@rstr["."""]+4#0)#0
</code>```

Example usage:

```<code>(@><""(->@rstr["."""]+4#0)#0)"helloworld"
</code>```

Explanation

```<code>@ (                         #. take input through a lambda
  join "" (                 #. join with newlines the following:
    (map                    #. result of mapping
      @ (                   #. this lambda
        rstr ["." ; ""] (     #. replace first char w/ empty string:
          + 4 #0               #. mapped item's codepoint + 4
        )
      )
    ) #0                    #. over the argument
  )
)
</code>```

Title: Encode the alphabet cipher

Body:
DASH, 27 bytes

@><""(->@rstr["."""]+4#0)#0

Example usage:

(@><""(->@rstr["."""]+4#0)#0)"helloworld"

Explanation

@ (                         #. take input through a lambda
  join "" (                 #. join with newlines the following:
    (map                    #. result of mapping
      @ (                   #. this lambda
        rstr ["." ; ""] (     #. replace first char w/ empty string:
          + 4 #0               #. mapped item's codepoint + 4
        )
      )
    ) #0                    #. over the argument
  )
)


问:
Draw an hourglass
Again inspired by a task for Programming 101 here's another challenge.

Input:

A positive integer n >= 3. (has to be odd)

Output:

n lines of asterisks, where the first line has n asterisks and every new line has two asterisks less than the line before. Until hitting 1 asterisk. From there every new line has two asterisks more than the line before until getting back to n asterisks. Spaces or something like spaces have to used to align the asterisks so that it really will look like an hourglass.

General rules:

Trailing newlines are allowed but do not have to be used.

indentation is a must.

This is code-golf, so shortest answer in bytes wins.

Since the course is taught in C++, I'm eager to see solutions in C++.

Test case (n=5):

```<code>*****
 ***
  *
 ***
*****
</code>```

答:
Swift 3, 139 130

```<code>let c={String(repeating:$0,count:$1)};func d(_ n:Int,_ i:Int=0)->String{let b=c(" ",i)+c("*",n)+"\n";return n>1 ?b+d(n-2,i+1)+b:b}
</code>```

On-line test

let c={(s,i)in(0..String{let b=c(" ",i)+c("*",n)+"\n";return n>1 ?b+d(n-2,i+1)+b:b}

Title: Draw an hourglass

Body:
Swift 3, 139 130

let c={String(repeating:$0,count:$1)};func d(_ n:Int,_ i:Int=0)->String{let b=c(" ",i)+c("*",n)+"\n";return n>1 ?b+d(n-2,i+1)+b:b}

On-line test

let c={(s,i)in(0..<i).reduce(""){(b,_)in b+s}};func d(_ n:Int,_ i:Int=0)->String{let b=c(" ",i)+c("*",n)+"\n";return n>1 ?b+d(n-2,i+1)+b:b}


问:
Alphabet triangle
You are to print this exact text:

```<code>A
ABA
ABCBA
ABCDCBA
ABCDEDCBA
ABCDEFEDCBA
ABCDEFGFEDCBA
ABCDEFGHGFEDCBA
ABCDEFGHIHGFEDCBA
ABCDEFGHIJIHGFEDCBA
ABCDEFGHIJKJIHGFEDCBA
ABCDEFGHIJKLKJIHGFEDCBA
ABCDEFGHIJKLMLKJIHGFEDCBA
ABCDEFGHIJKLMNMLKJIHGFEDCBA
ABCDEFGHIJKLMNONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNONMLKJIHGFEDCBA
ABCDEFGHIJKLMNMLKJIHGFEDCBA
ABCDEFGHIJKLMLKJIHGFEDCBA
ABCDEFGHIJKLKJIHGFEDCBA
ABCDEFGHIJKJIHGFEDCBA
ABCDEFGHIJIHGFEDCBA
ABCDEFGHIHGFEDCBA
ABCDEFGHGFEDCBA
ABCDEFGFEDCBA
ABCDEFEDCBA
ABCDEDCBA
ABCDCBA
ABCBA
ABA
A
</code>```

Specs

Extra trailing newlines are allowed at the end of the output.

Extra trailing spaces (U+0020) are allowed at the end of each line, including the extra trailing newlines.

You can use all lowercase instead of all uppercase, but you cannot print partially lowercase partially uppercase.

You can return the text as a function output instead of printing it in a full program.

Scoring

Since this is a triangle, and a triangle has 3 sides, and 3 is a small number, your code should be small in terms of byte-count.

答:
Racket 327 bytes

```<code>(define(sr s)(list->string(reverse(string->list s))))(let loop((n 0)(s"A")(ol'("A")))(let*((st string)(mr(floor(/(string-length s)2)))
(mc(string-ref s mr))(ss(substring s 0 mr))(ns(string-append ss(st mc)(st(integer->char(+ 65(add1 n))))(st mc)(sr ss))))(if(< n 25)
(loop(add1 n)ns(cons ns ol))(append(reverse ol)(rest ol)))))
</code>```

Ungolfed:

```<code>(define (f)

  (define (sr s)                     ; sub-fn to reverse a string;
    (list->string
     (reverse
      (string->list s))))

  (let loop ((n 0)
             (s "A")
             (ol '("A")))
    (let* ((st string)
           (mr (floor(/(string-length s)2)))
           (mc (string-ref s mr))
           (ss (substring s 0 mr))
           (ns (string-append
                ss
                (st mc)
                (st (integer->char (+ 65(add1 n))))
                (st mc)
                (sr ss))))
      (if (< n 25)
          (loop (add1 n)
                ns
                (cons ns ol))
          (append(reverse ol)(rest ol))
          ))))
</code>```

Testing:

```<code>(f)
</code>```

Output:

```<code>'("A"
  "ABA"
  "ABCBA"
  "ABCDCBA"
  "ABCDEDCBA"
  "ABCDEFEDCBA"
  "ABCDEFGFEDCBA"
  "ABCDEFGHGFEDCBA"
  "ABCDEFGHIHGFEDCBA"
  "ABCDEFGHIJIHGFEDCBA"
  "ABCDEFGHIJKJIHGFEDCBA"
  "ABCDEFGHIJKLKJIHGFEDCBA"
  "ABCDEFGHIJKLMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMLKJIHGFEDCBA"
  "ABCDEFGHIJKLKJIHGFEDCBA"
  "ABCDEFGHIJKJIHGFEDCBA"
  "ABCDEFGHIJIHGFEDCBA"
  "ABCDEFGHIHGFEDCBA"
  "ABCDEFGHGFEDCBA"
  "ABCDEFGFEDCBA"
  "ABCDEFEDCBA"
  "ABCDEDCBA"
  "ABCDCBA"
  "ABCBA"
  "ABA"
  "A")
</code>```

Title: Alphabet triangle

Body:
Racket 327 bytes

(define(sr s)(list->string(reverse(string->list s))))(let loop((n 0)(s"A")(ol'("A")))(let*((st string)(mr(floor(/(string-length s)2)))
(mc(string-ref s mr))(ss(substring s 0 mr))(ns(string-append ss(st mc)(st(integer->char(+ 65(add1 n))))(st mc)(sr ss))))(if(< n 25)
(loop(add1 n)ns(cons ns ol))(append(reverse ol)(rest ol)))))

Ungolfed:

(define (f)

  (define (sr s)                     ; sub-fn to reverse a string;
    (list->string
     (reverse
      (string->list s))))

  (let loop ((n 0)
             (s "A")
             (ol '("A")))
    (let* ((st string)
           (mr (floor(/(string-length s)2)))
           (mc (string-ref s mr))
           (ss (substring s 0 mr))
           (ns (string-append
                ss
                (st mc)
                (st (integer->char (+ 65(add1 n))))
                (st mc)
                (sr ss))))
      (if (< n 25)
          (loop (add1 n)
                ns
                (cons ns ol))
          (append(reverse ol)(rest ol))
          ))))

Testing:

(f)

Output:

'("A"
  "ABA"
  "ABCBA"
  "ABCDCBA"
  "ABCDEDCBA"
  "ABCDEFEDCBA"
  "ABCDEFGFEDCBA"
  "ABCDEFGHGFEDCBA"
  "ABCDEFGHIHGFEDCBA"
  "ABCDEFGHIJIHGFEDCBA"
  "ABCDEFGHIJKJIHGFEDCBA"
  "ABCDEFGHIJKLKJIHGFEDCBA"
  "ABCDEFGHIJKLMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNONMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMNMLKJIHGFEDCBA"
  "ABCDEFGHIJKLMLKJIHGFEDCBA"
  "ABCDEFGHIJKLKJIHGFEDCBA"
  "ABCDEFGHIJKJIHGFEDCBA"
  "ABCDEFGHIJIHGFEDCBA"
  "ABCDEFGHIHGFEDCBA"
  "ABCDEFGHGFEDCBA"
  "ABCDEFGFEDCBA"
  "ABCDEFEDCBA"
  "ABCDEDCBA"
  "ABCDCBA"
  "ABCBA"
  "ABA"
  "A")


问:
Print some JSON
This challenge is straightforward, but hopefully, there are plenty of avenues you can approach it:

You need to print/return a valid JSON object of at least 15 characters, not counting unessential whitespace.  Your program should work without any input.

In the interest of clarity, a JSON object starts and ends with curly braces {}, and contains zero or more key:value pairs separated by commas.  The full JSON specification can be found at json.org, and the output of your code must pass this validator.

Therefore, any of the following would not be valid:

```<code>4                               //Too short, not an object
"really, really long string"    //A string, not an object
["an","array","of","values"]    //An array is not a JSON object
{"this":4      }                //You can't count unessential whitespace
{"1":1,"2":3}                   //Too short
{"a really long string"}        //Not valid JSON, it needs a value
{'single-quoted':3}             //JSON requires double-quotes for strings
</code>```

However, the following would be valid:

```<code>{"1":1,"2":2,"3":3,"4":4}       //Long enough
{"whitespace      ":4}          //This whitespace isn't unessential
</code>```

Non-programming languages are allowed on this challenge.  You may return a string from a function, or print it out.  This is a code-golf, so answer it with as little code as possible!

答:
Python 2, 13 bytes

```<code>print{"'":.1}
</code>```

Outputs:

```<code>{"'": 0.10000000000000001}
</code>```

Since tenths can't be stored exactly in binary Python outputs a 1 followed by 15 zeros followed by a 1 after the decimal point. Need double quotes around the single quote to not have the double quotes converted to single quotes (thanks to @JonathanAllan's comment to @xnor's answer).

Title: Print some JSON

Body:
Python 2, 13 bytes

print{"'":.1}

Outputs:

{"'": 0.10000000000000001}

Since tenths can't be stored exactly in binary Python outputs a 1 followed by 15 zeros followed by a 1 after the decimal point. Need double quotes around the single quote to not have the double quotes converted to single quotes (thanks to @JonathanAllan's comment to @xnor's answer).


问:
Alphabet triangle strikes again

Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

答:
Racket 160 bytes

```<code>(let p((n 65)(t 0)(x 0))(when(> n 90)(set! n 65))(when(> x t)(set! t(+ 2 t))
(set! x 0)(displayln""))(when(< t 51)(display(integer->char n))(p(+ 1 n)t(+ 1 x))))
</code>```

Ungolfed:

```<code>(define (f)
  (let loop ((n 65)
             (t 0)
             (x 0))
    (when (> n 90)
      (set! n 65))
    (when (> x t)
      (set! t (+ 2 t))
      (set! x 0)
      (displayln ""))
    (when (< t 51)
        (display (integer->char n))
        (loop (add1 n)
              t
              (add1 x)))))
</code>```

Testing:

```<code>(f)
</code>```

Output:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Title: Alphabet triangle strikes again

Body:
Racket 160 bytes

(let p((n 65)(t 0)(x 0))(when(> n 90)(set! n 65))(when(> x t)(set! t(+ 2 t))
(set! x 0)(displayln""))(when(< t 51)(display(integer->char n))(p(+ 1 n)t(+ 1 x))))

Ungolfed:

(define (f)
  (let loop ((n 65)
             (t 0)
             (x 0))
    (when (> n 90)
      (set! n 65))
    (when (> x t)
      (set! t (+ 2 t))
      (set! x 0)
      (displayln ""))
    (when (< t 51)
        (display (integer->char n))
        (loop (add1 n)
              t
              (add1 x)))))

Testing:

(f)

Output:

A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


答:
05AB1E, <s>14</s> <s>13</s> 11 bytes

```<code>A27×26L·<£»
</code>```

Try it online!

Explanation:

```<code>A27×         # Push the alphabet repeated 27 times
    26L      # Push [1, 2, ..., 26]
       ·     # Multiply by 2 [2, 4, ..., 52]
        <    # Subtract 1 [1, 3, ..., 51]
         £   # Repeated slice
          »  # Join by newlines
             # Implicit print
</code>```

Title: Alphabet triangle strikes again

Body:
Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

Body:
05AB1E, <s>14</s> <s>13</s> 11 bytes

A27×26L·<£»

Try it online!

Explanation:

A27×         # Push the alphabet repeated 27 times
    26L      # Push [1, 2, ..., 26]
       ·     # Multiply by 2 [2, 4, ..., 52]
        <    # Subtract 1 [1, 3, ..., 51]
         £   # Repeated slice
          »  # Join by newlines
             # Implicit print


问:
Print the digital root
This is different from My Word can beat up your Word as it is less complex and only requires you to calculate it, and not compare them.

To find the digital root, take all of the digits of a number, add them, and repeat until you get a one-digit number. For example, if the number was 12345, you would add 1, 2, 3, 4, and 5, getting 15. You would then add 1 and 5, giving you 6.

Your task

Given an integer N (0 <= N <= 10000) through STDIN, print the digital root of N.

Test cases

```<code>1 -> 1
45 -> 9
341 -> 8
6801 -> 6
59613 -> 6
495106 -> 7
</code>```

Remember, this is code-golf, so the code with the smallest number of bytes wins.

答:
Pyth - <s>7</s> <s>4</s> <s>6</s> 7 bytes

Not the best one, but still beats a decent amount of answers:

```<code>|ejQ9 9
</code>```

Like the previous version, but handling also cases of multiples of 9, using logical or.

This version fails the 45 testcase:

```<code>ejQ9
</code>```

Explanation:

```<code> jQ9  -> converting the input to base 9
e     -> taking the last digit
</code>```

Try it here

Try the previous version here!

Previous solutions:

```<code>&Qh%tQ9
</code>```

Explanation:

```<code>    tQ    -> tail: Q-1
   %tQ9   -> Modulo: (Q-1)%9
  h%tQ9   -> head: (Q-1)%9+1
&Qh%tQ9   -> Logical 'and' - takes the first null value. If Q is 0 - returns zero, otherwise returns the (Q-1)%9+1 expression result
</code>```

You're invited to try it here!

Title: Print the digital root

Body:
Pyth - <s>7</s> <s>4</s> <s>6</s> 7 bytes

Not the best one, but still beats a decent amount of answers:

|ejQ9 9

Like the previous version, but handling also cases of multiples of 9, using logical or.

This version fails the 45 testcase:

ejQ9

Explanation:

 jQ9  -> converting the input to base 9
e     -> taking the last digit

Try it here

Try the previous version here!

Previous solutions:

&Qh%tQ9

Explanation:

    tQ    -> tail: Q-1
   %tQ9   -> Modulo: (Q-1)%9
  h%tQ9   -> head: (Q-1)%9+1
&Qh%tQ9   -> Logical 'and' - takes the first null value. If Q is 0 - returns zero, otherwise returns the (Q-1)%9+1 expression result

You're invited to try it here!


问:
Rearranging the sequence

Introduction

Let's observe the following sequence (non-negative integers):

```<code>0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ...
</code>```

For example, let's take the first three numbers. These are 0, 1, 2. The numbers used in this sequence can be ordered in six different ways:

```<code>012   120
021   201
102   210
</code>```

So, let's say that F(3) = 6. Another example is F(12). This contains the numbers:

```<code>0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
</code>```

Or the concatenated version:

```<code>01234567891011
</code>```

To find the number of ways to rearrange this, we first need to look at the length of this string. The length of this string is 14. So we compute 14!. However, for example the ones can exchange places without disrupting the final string. There are 2 zeroes, so there are 2! ways to exhange the zeroes without disrupting the order. There are also 4 ones, so there are 4! ways to switch the ones. We divide the total by these two numbers:

This has 14! / (4! × 2!) = 1816214400 ways to arrange the string 01234567891011. So we can conclude that F(12) = 1816214400.

The task

Given N, output F(N). For the ones who don't need the introduction. To compute F(N), we first concatenate the first N non-negative integers (e.g. for N = 12, the concatenated string would be 01234567891011) and calculate the number of ways to arrange this string.

Test cases

```<code>Input:   Output:
0        1
1        1
2        2
3        6
4        24
5        120
6        720
7        5040
8        40320
9        362880
10       3628800
11       119750400
12       1816214400
13       43589145600
14       1111523212800
15       30169915776000
</code>```

Note

Computing the answer must be computed within a time limit of 10 seconds, brute-forcing is disallowed.

This is code-golf, so the submission with the least amount of bytes wins!

答:
R, 118 bytes

About 8 months late to the party but thought I'd give it a go because it looked like an interesting challenge.

```<code>function(n,x=as.numeric(el(strsplit(paste(1:n-1,collapse=""),""))),F=factorial)`if`(n,F(sum(1|x))/prod(F(table(x))),1)
</code>```

Try it on R-fiddle

Explained

Generate vector 0 ... n-1 and collapse it to a string: paste(1:n-1,collapse="")

Split string into its digits and convert to numeric(store as x): x=as.numeric(el(strsplit(...,"")))

To calculate the numerator we simply do factorial(sum(1|x)) which is just #digits!

To calculate the denominator we make use of table to construct a contingency table that list the frequencies. In the case of F(12) the table generated is:

```<code>0 1 2 3 4 5 6 7 8 9
2 4 1 1 1 1 1 1 1 1
</code>```

Which means we can take the use factorial() (which by the way is vectorized) on the count and simply take the product: prod(factorial(table(x)))

Note: step 4 and 5 are only carried through if n>0 otherwise return 1.

Title: Rearranging the sequence

Body:
R, 118 bytes

About 8 months late to the party but thought I'd give it a go because it looked like an interesting challenge.

function(n,x=as.numeric(el(strsplit(paste(1:n-1,collapse=""),""))),F=factorial)`if`(n,F(sum(1|x))/prod(F(table(x))),1)

Try it on R-fiddle

Explained

Generate vector 0 ... n-1 and collapse it to a string: paste(1:n-1,collapse="")

Split string into its digits and convert to numeric(store as x): x=as.numeric(el(strsplit(...,"")))

To calculate the numerator we simply do factorial(sum(1|x)) which is just #digits!

To calculate the denominator we make use of table to construct a contingency table that list the frequencies. In the case of F(12) the table generated is:

0 1 2 3 4 5 6 7 8 9
2 4 1 1 1 1 1 1 1 1

Which means we can take the use factorial() (which by the way is vectorized) on the count and simply take the product: prod(factorial(table(x)))

Note: step 4 and 5 are only carried through if n>0 otherwise return 1.


问:
Alphabet Diamond
You've seen the amazing alphabet triangle, the revenge of the alphabet triangle and now it's time for the revenge of the revenge of the alphabet triangle!

Introducing...

THE ALPHABET DIAMOND!

Your task is to output this exact text, lowercase/uppercase does not matter, though newlines do:

```<code>bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc
defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed
efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe
fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf
ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg
hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih
ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji
jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj
klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk
lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml
mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm
nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon
opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo
pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp
qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq
rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr
stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts
tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut
uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu
vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv
wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw
xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx
yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy
zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz
yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy
xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx
wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw
vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv
uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu
tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut
stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts
rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr
qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq
pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp
opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo
nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon
mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm
lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml
klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk
jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj
ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji
hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih
ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg
fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf
efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe
defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed
cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc
bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
</code>```

This is code-golf, lowest bytecount wins.

Rules:

Standard loopholes are disallowed.

a must be the center of the alphabet diamond.

答:
Racket 293 bytes

```<code>(let*((ls list->string)(rr reverse)(sr(λ(s)(ls(rr(string->list s))))))(let p((s(ls(for/list((i(range 97 123)))(integer->char i))))
(n 0)(ol'()))(let*((c(string-ref s 0))(ss(substring s 1 26))(s(string-append ss(string c)(sr ss))))(if(< n 53)(p s(+ 1 n)(cons s ol))
(append(rr ol)(cdr ol))))))
</code>```

Ungolfed:

```<code>(define (f)
  (define (sr s)           ; sub-fn reverse string;
    (list->string
     (reverse
      (string->list s))))
  (let loop ((s
              (list->string
               (for/list
                   ((i
                     (range 97 123)))
                 (integer->char i))))
             (n 0)
             (ol '()))
    (define c (string-ref s 0))
    (define ss (substring s 1 26))
    (set! s (string-append
             ss
             (string c)
             (sr ss)))
    (if (< n 53)
        (loop s (add1 n) (cons s ol))
        (append (reverse ol) (rest ol)))))
</code>```

Testing:

```<code>(f)
</code>```

Output:

```<code>'("bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb")
</code>```

Title: Alphabet Diamond

Body:
Racket 293 bytes

(let*((ls list->string)(rr reverse)(sr(λ(s)(ls(rr(string->list s))))))(let p((s(ls(for/list((i(range 97 123)))(integer->char i))))
(n 0)(ol'()))(let*((c(string-ref s 0))(ss(substring s 1 26))(s(string-append ss(string c)(sr ss))))(if(< n 53)(p s(+ 1 n)(cons s ol))
(append(rr ol)(cdr ol))))))

Ungolfed:

(define (f)
  (define (sr s)           ; sub-fn reverse string;
    (list->string
     (reverse
      (string->list s))))
  (let loop ((s
              (list->string
               (for/list
                   ((i
                     (range 97 123)))
                 (integer->char i))))
             (n 0)
             (ol '()))
    (define c (string-ref s 0))
    (define ss (substring s 1 26))
    (set! s (string-append
             ss
             (string c)
             (sr ss)))
    (if (< n 53)
        (loop s (add1 n) (cons s ol))
        (append (reverse ol) (rest ol)))))

Testing:

(f)

Output:

'("bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb")