The Tabula Recta (sometimes called a 'Vigenere Table'), was created by Johannes Trithemius, and has been used in several ciphers, including all variants of Bellaso's Vigenere cipher and the Trithemius cipher. It looks like this:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
DEFGHIJKLMNOPQRSTUVWXYZABC
EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE
GHIJKLMNOPQRSTUVWXYZABCDEF
HIJKLMNOPQRSTUVWXYZABCDEFG
IJKLMNOPQRSTUVWXYZABCDEFGH
JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ
LMNOPQRSTUVWXYZABCDEFGHIJK
MNOPQRSTUVWXYZABCDEFGHIJKL
NOPQRSTUVWXYZABCDEFGHIJKLM
OPQRSTUVWXYZABCDEFGHIJKLMN
PQRSTUVWXYZABCDEFGHIJKLMNO
QRSTUVWXYZABCDEFGHIJKLMNOP
RSTUVWXYZABCDEFGHIJKLMNOPQ
STUVWXYZABCDEFGHIJKLMNOPQR
TUVWXYZABCDEFGHIJKLMNOPQRS
UVWXYZABCDEFGHIJKLMNOPQRST
VWXYZABCDEFGHIJKLMNOPQRSTU
WXYZABCDEFGHIJKLMNOPQRSTUV
XYZABCDEFGHIJKLMNOPQRSTUVW
YZABCDEFGHIJKLMNOPQRSTUVWX
ZABCDEFGHIJKLMNOPQRSTUVWXY
I frequently need this, but can't find it anywhere on the internet to copy and paste from. Because the square table is so long, and takes frigging ages to type, your code must be as short as possible.
Rules/Requirements
- Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included.
- If it is possible, provide a link to a site where your program can be tested.
- Your program must not write anything to
STDERR. - Standard Loopholes are forbidden.
- Your program can output in any case, but it must be printed (not an array or similar).
Scoring
Programs are scored according to bytes, in UTF-8 by default or a different character set of your choice.
Eventually, the answer with the least bytes will win.
Submissions
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes
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:
# Ruby, <s>104</s> <s>101</s> 96 bytes
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:
# Perl, 43 + 2 (-p flag) = 45 bytes
You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes
Leaderboard
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
/* Configuration */
var QUESTION_ID = 86986; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 53406; // This should be the user ID of the challenge author.
/* App */
var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;
function answersUrl(index) {
return "https://api.stackexchange.com/2.2/questions/" + QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}
function commentUrl(index, answers) {
return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}
function getAnswers() {
jQuery.ajax({
url: answersUrl(answer_page++),
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
answers.push.apply(answers, data.items);
answers_hash = [];
answer_ids = [];
data.items.forEach(function(a) {
a.comments = [];
var id = +a.share_link.match(/\d+/);
answer_ids.push(id);
answers_hash[id] = a;
});
if (!data.has_more) more_answers = false;
comment_page = 1;
getComments();
}
});
}
function getComments() {
jQuery.ajax({
url: commentUrl(comment_page++, answer_ids),
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
data.items.forEach(function(c) {
if (c.owner.user_id === OVERRIDE_USER)
answers_hash[c.post_id].comments.push(c);
});
if (data.has_more) getComments();
else if (more_answers) getAnswers();
else process();
}
});
}
getAnswers();
var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;
var OVERRIDE_REG = /^Override\s*header:\s*/i;
function getAuthorName(a) {
return a.owner.display_name;
}
function process() {
var valid = [];
answers.forEach(function(a) {
var body = a.body;
a.comments.forEach(function(c) {
if(OVERRIDE_REG.test(c.body))
body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
});
var match = body.match(SCORE_REG);
if (match)
valid.push({
user: getAuthorName(a),
size: +match[2],
language: match[1],
link: a.share_link,
});
});
valid.sort(function (a, b) {
var aB = a.size,
bB = b.size;
return aB - bB
});
var languages = {};
var place = 1;
var lastSize = null;
var lastPlace = 1;
valid.forEach(function (a) {
if (a.size != lastSize)
lastPlace = place;
lastSize = a.size;
++place;
var answer = jQuery("#answer-template").html();
answer = answer.replace("{{PLACE}}", lastPlace + ".")
.replace("{{NAME}}", a.user)
.replace("{{LANGUAGE}}", a.language)
.replace("{{SIZE}}", a.size)
.replace("{{LINK}}", a.link);
answer = jQuery(answer);
jQuery("#answers").append(answer);
var lang = a.language;
if (/<a/.test(lang)) lang = jQuery(lang).text();
languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link};
});
var langs = [];
for (var lang in languages)
if (languages.hasOwnProperty(lang))
langs.push(languages[lang]);
langs.sort(function (a, b) {
if (a.lang > b.lang) return 1;
if (a.lang < b.lang) return -1;
return 0;
});
for (var i = 0; i < langs.length; ++i)
{
var language = jQuery("#language-template").html();
var lang = langs[i];
language = language.replace("{{LANGUAGE}}", lang.lang)
.replace("{{NAME}}", lang.user)
.replace("{{SIZE}}", lang.size)
.replace("{{LINK}}", lang.link);
language = jQuery(language);
jQuery("#languages").append(language);
}
}
body { text-align: left !important}
#answer-list {
padding: 10px;
width: 290px;
float: left;
}
#language-list {
padding: 10px;
width: 290px;
float: left;
}
table thead {
font-weight: bold;
}
table td {
padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="answer-list">
<h2>Leaderboard</h2>
<table class="answer-list">
<thead>
<tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
</thead>
<tbody id="answers">
</tbody>
</table>
</div>
<div id="language-list">
<h2>Winners by Language</h2>
<table class="language-list">
<thead>
<tr><td>Language</td><td>User</td><td>Score</td></tr>
</thead>
<tbody id="languages">
</tbody>
</table>
</div>
<table style="display: none">
<tbody id="answer-template">
<tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
</tbody>
</table>
<table style="display: none">
<tbody id="language-template">
<tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
</tbody>
</table>
173 Answers 173
Vim, (削除) 25 (削除ここまで) 23 bytes
:h<_↵jjYZZP25@='Ypx$p'↵
Where ↵ is the Return key.
:h<_↵ Open the help section v_b_<_example.
jjY Copy the "abcdefghijklmnopqrstuvwxyz" line.
ZZP Close this buffer and paste in ours.
25@=' '↵ Run these commands 25 times:
Yp Duplicate line and move to column 1 of new line.
x Cut the first character.
$p Move to the end and paste.
EDIT: lowercase is okay, so I can save two keys.
-
27\$\begingroup\$ That
:h<_<cr>jjYis genius \$\endgroup\$Downgoat– Downgoat2016年07月30日 18:18:37 +00:00Commented Jul 30, 2016 at 18:18 -
3\$\begingroup\$ Wow, that's amazing! OP said lowercase was OK so you can remove
V~\$\endgroup\$DJMcMayhem– DJMcMayhem2016年07月30日 18:22:25 +00:00Commented Jul 30, 2016 at 18:22 -
4\$\begingroup\$ @RobStarling see: meta.codegolf.stackexchange.com/q/8995/40695 \$\endgroup\$Downgoat– Downgoat2016年07月30日 22:57:22 +00:00Commented Jul 30, 2016 at 22:57
-
5\$\begingroup\$ I dare someone to try this in emacs. \$\endgroup\$addison– addison2016年07月31日 03:49:39 +00:00Commented Jul 31, 2016 at 3:49
-
2\$\begingroup\$ @addison Emacs answer \$\endgroup\$TuxCrafting– TuxCrafting2016年08月03日 13:09:01 +00:00Commented Aug 3, 2016 at 13:09
05AB1E, (削除) 6 (削除ここまで) 5 bytes
Thanks to Downgoat for saving 1 byte. Code:
ADv=À
Explanation:
A # Push the lowercase alphabet.
D # Duplicate it.
v # For each in the alphabet...
= # Print without popping and with a newline.
À # Rotate 1 to the left.
Uses the CP-1252 encoding. Try it online!.
-
\$\begingroup\$ What is the purpose of duplicating it? \$\endgroup\$Esolanging Fruit– Esolanging Fruit2016年11月19日 19:32:12 +00:00Commented Nov 19, 2016 at 19:32
-
2\$\begingroup\$ @Challenger5 The
vcommand consumes a value, iterating over it. In this case, it consumes the alphabet, so it iterates 26 times. That's also the exact amount of times we need to iterate of the=Àfunction. The=leaves the stack intact and theÀonly rotates the top of the stack element 1 to the left. Does this answer your question? :) \$\endgroup\$Adnan– Adnan2016年11月19日 20:01:18 +00:00Commented Nov 19, 2016 at 20:01 -
\$\begingroup\$ @EsolangingFruit I know this was already answered six years ago, but the
Dvcould also have just been2F(loop 26 times) for the same result: try it online. :) I'm not sure if2(26) was an existing constant in 05AB1E mid-2016, though. \$\endgroup\$Kevin Cruijssen– Kevin Cruijssen2021年10月21日 14:02:24 +00:00Commented Oct 21, 2021 at 14:02
Python 2, (削除) 59 (削除ここまで) (削除) 57 (削除ここまで) 53 bytes
a=range(65,91)*27
a[::-27]=[10]*26
print bytearray(a)
Thanks to @xsot for -4 bytes!
-
4\$\begingroup\$ I like this one. By the way, you can shorten the last line to
print bytearray(a). \$\endgroup\$xsot– xsot2016年07月31日 04:44:39 +00:00Commented Jul 31, 2016 at 4:44
///, 220 bytes
/|/\/\///n/WXY|m/JKL|l/PQRS|k/CDEF|j/ZaNfV|i/MbAeI|h/TUcO|g/GHdB|f/OlTU|e/BkGH|d/ImMbA|c/VnZaN|b/NfVnZ|a/AeImM/ab
ed
kg
DEFgC
EFgCD
FgCDE
gk
HdBkG
de
mi
KLiJ
LiJK
im
ba
fc
lh
QRShP
RShPQ
ShPQR
hl
UcOlT
cf
nj
XYjW
YjWX
jn
This was surprisingly non-trivial and I have no clue whether it's optimal.
(削除) The only way to golf a problem like this in /// is by extracting common substrings. (削除ここまで) (Turns out I was wrong.) However, due to the nature of the output it's not at all clear which substrings should best be extracted since you can't actually extract the entire alphabet due to the linebreaks. So you'll need to extract some substrings of the wrapped alphabet, but then there are trade-offs in terms of how long you make the substrings and which ones you choose.
So here's what I did. This is a CJam script which finds all substrings up to length 25 in the given string and for each of them computes how many bytes its extracting would save. Basically if there are N copies of a length-M substring, you'd save (N-1)*(M-1) - 5 substrings, these substrings don't contain slashes. Also, technically, when you've already extract 8 substrings or so, the constant offset at the end reduces to -4, but the script doesn't consider that.
Anyway, here's what I did with the script:
- Run the script against the current code (which is initially just the output).
- Out of the substrings that yield the largest improvement, pick the shortest one. If there are several, pick the lexicographically smallest (from what I can tell, for the given input this reduces overlaps between substrings).
- Replace all occurrences of the chosen substring in the code with an unused lower case letter.
- Prepend
/x/ABC/to the code wherexis the chosen letter andABCis the substring. - Repeat until there are no substrings left that would save anything.
At the end, we save a few more bytes by replacing the resulting // with | and prepending /|/\/\// (this is why extracting substrings only costs 4 instead of 5 bytes after the 8th substring or so).
Like I said, I have no clue whether this is optimal and I find the rather irregular-looking result quite interesting. It might be possible to get to a shorter solution by chosing non-optimal (but more) substrings somewhere down the line. I wonder what the complexity class of this problem is...
-
\$\begingroup\$ That... is... brilliant... \$\endgroup\$user53406– user534062016年07月31日 11:12:43 +00:00Commented Jul 31, 2016 at 11:12
-
1\$\begingroup\$ @GeorgeGibson Thanks... I had to start over halfway through when I noticed a certain
YXin the output. ;) \$\endgroup\$Martin Ender– Martin Ender2016年07月31日 11:13:31 +00:00Commented Jul 31, 2016 at 11:13 -
\$\begingroup\$ My answer is gone, it was a dupe of this (bigger and later). +1 for that [incredible golfing]! \$\endgroup\$Erik the Outgolfer– Erik the Outgolfer2016年08月01日 08:51:45 +00:00Commented Aug 1, 2016 at 8:51
-
\$\begingroup\$ Regarding complexity class, shouldn't the problem be undecidable since /// is Turing complete? The problem is "given a string, find the shortest /// program that outputs it". Except for small strings, there would exist /// programs that loop indefinitely (but cannot be proven to loop indefinitely) that cannot be shown to not produce the desired output without running them forever. Formal proof I'm myself not sure yet but intuitively isn't it possible? \$\endgroup\$ghosts_in_the_code– ghosts_in_the_code2019年06月01日 14:07:43 +00:00Commented Jun 1, 2019 at 14:07
C, 47 bytes
i;f(){for(i=702;i--;)putchar(i%27?90-i%26:10);}
A single loop, printing the alphabet every 26 characters but with every 27th character replaced by a newline.
-
1\$\begingroup\$ Damn! I just wrote the exact same function! :-) You can save the first semicolon by using
f(i)then just callf()without any arguments. \$\endgroup\$Level River St– Level River St2016年07月31日 02:23:18 +00:00Commented Jul 31, 2016 at 2:23 -
\$\begingroup\$ @LevelRiverSt That would be relying on undefined behavior. \$\endgroup\$Anders Kaseorg– Anders Kaseorg2016年07月31日 03:07:39 +00:00Commented Jul 31, 2016 at 3:07
-
3\$\begingroup\$ It's ultimately up to you, but PPCG considers languages to be defined by their implementations, so as long as you mention in which compiler it works, relying on UB is not considered a problem. \$\endgroup\$Dennis– Dennis2016年07月31日 05:53:44 +00:00Commented Jul 31, 2016 at 5:53
-
\$\begingroup\$ you can shave 1 byte by initializing i when first mentioned:
i=702;f(){for(;i--;)//...\$\endgroup\$tucuxi– tucuxi2016年08月02日 12:49:51 +00:00Commented Aug 2, 2016 at 12:49 -
3\$\begingroup\$ @tucuxi No, because function answers have to be reusable. \$\endgroup\$Anders Kaseorg– Anders Kaseorg2016年08月02日 20:14:51 +00:00Commented Aug 2, 2016 at 20:14
J, 15 bytes
u:65+26|+/~i.26
u:65+26|+/~i.26
i.26 creates vector [0 1 2 ... 25]
+/~ builds an addition table with itself
26| modulo 26 to every element
65+ add 65 to every element
u: convert every element from codepoint to character
-
\$\begingroup\$ Nice! Very clever arithmetic. The simplest approach that uses
|. (Shift)is 8 bytes longer!(i.26)(|."0 _)u:65+i.26\$\endgroup\$Dan Oak– Dan Oak2016年07月30日 18:55:27 +00:00Commented Jul 30, 2016 at 18:55 -
1\$\begingroup\$ @dahnoak You can shorten it to 16 bytes
u:65+1&|.^:]i.26since the power adverbs tracks previous results if given a list. \$\endgroup\$miles– miles2016年07月30日 22:53:46 +00:00Commented Jul 30, 2016 at 22:53 -
1\$\begingroup\$ @miles Nice, my approach using
|.is 17 bytes:u:65+|."0 1/~i.26(still using/~) \$\endgroup\$Leaky Nun– Leaky Nun2016年07月30日 23:04:13 +00:00Commented Jul 30, 2016 at 23:04 -
1\$\begingroup\$ @LeakyNun Another 17 byte approach is
u:65+(|./~,.)i.26. I got rid of the rank by using a hook and,.to columnize the range but it ended up the same length. \$\endgroup\$miles– miles2016年07月30日 23:19:06 +00:00Commented Jul 30, 2016 at 23:19 -
\$\begingroup\$ don't you know if I can find the source code of tryj.tk somewhere? I couldn't find any info neither about it neither about the author (f211) \$\endgroup\$Dan Oak– Dan Oak2016年08月05日 11:27:15 +00:00Commented Aug 5, 2016 at 11:27
///, 128 bytes
/:/fABCDEFGHIJKLMNOPQRSTUVWXYZ
fbfbAfxf
xbA_xf_x
xfbbbAfbb//x/bff//f/\///b/\\:B:C:D:E:F:G:H:I:J:K:L:M:N:O:P:Q:R:S:T:U:V:W:X:Y:Z:
Inspired by Jakube's amazing answer to the L-phabet challenge, I thought I'd try my hand as well at actual programming in /// as opposed to just using it for compression. This was pretty tricky and I needed four attempts, but in the end it came out much shorter than my compression-based solution.
Explanation
A quick primer on ///: basically the interpreter just reads the code character by character and does the following:
- If it's neither a
\nor a/, print it. - If it's a
\, print the next character. - If it's a
/, parse a/x/y/instruction (with the same escaping rules) and repeatedly substitute allxin the remaining code withy.
Taking some more inspiration from Jakube, for simplicity I'll just explain a 4x4 version of this:
/:/fABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbb//x/bff//f/\///b/\\:B:C:D:
We start by replacing those : with the stuff between the second and third /. This will end up being the code the rotates the subsequent rows. We get this:
/x/bff//f/\///b/\\fABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbbBfABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbbCfABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbbDfABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbb
The f, b and x are just shorthands for common strings, which we'll expand now. The f is for slashes, the b is for backslashes and the x is for \// which happens to come up quite a lot. The reason I'm using aliases for the single-character substrings / and \ is that they'd have to be escaped in the first substitution instruction, so I'm actually saving quite a lot of bytes by not needing all those backslashes. Here's what we get after x, f and b have been filled in:
ABCD
/\/\A/\///
\//\A_\///_\//
\///\\\A/\\B/ABCD
/\/\A/\///
\//\A_\///_\//
\///\\\A/\\C/ABCD
/\/\A/\///
\//\A_\///_\//
\///\\\A/\\D/ABCD
/\/\A/\///
\//\A_\///_\//
\///\\\A/\\
Very readable.
So the first line is just printed verbatim. Then we get to the funky part that rotates all further rows. It actually consists of four different instructions. One thing to notice is that I've escaped all occurrences of A within these instructions. The reason for this is that it allows me to distinguish As within the instructions from As in the remaining rows, which need to be processed differently.
/\/\A/\//
This matches /A and replaces it with /, removing the A. Note that this substring only appears at the front of each ABCD, so this drops the first character of all subsequent lines:
/
\//\A_\//
This matches a linefeed followed by a slash and replaces it with A_/. So this inserts an A at the end of each line, completing the rotation and also turns the linefeed into an underscore.
/_\//
\//
This matches _/ and replaces it with a linefeed followed by a slash. The reason I need to make this detour via the underscore is the fact that /// applies each instruction repeatedly until the string no longer matches. That means you can never use an instruction of the form /x/axb/ where x, a and b are arbitrary strings, because after the substitution x will always still match. In particular, this means we can't just insert something in front of a linefeed. We need to replace the linefeed in the process and the undo this replacement.
/\\\A/\\B/
This matches \A and replaces it with \B, so that the instructions after the remaining rows process the next character. After all four instructions have been processed the remaining string looks like this:
BCDA
/\/\B/\///
\//\B_\///_\//
\///\\\B/\\C/BCDA
/\/\B/\///
\//\B_\///_\//
\///\\\B/\\D/BCDA
/\/\B/\///
\//\B_\///_\//
\///\\\B/\\
So now the first rotated row gets printed, and then the next set of instructions rotates the remaining rows by another cell and so on. After the last rotation, we have a few more instructions that we can ignore and then we end with the incomplete instruction:
/\\\B/\\
Incomplete instructions at the end are simply ignored and the program terminates.
-
\$\begingroup\$ Nice one. Yesterday I experimented a little bit with a different idea. I wanted to substitute each character in each line. Something like
A->B,B->C, ... But it didn't quite work. Removing the first char and appending it at the end is definitly a much better approach. \$\endgroup\$Jakube– Jakube2016年08月02日 08:56:11 +00:00Commented Aug 2, 2016 at 8:56 -
\$\begingroup\$ @Jakube I tried that as well but wasn't getting anywhere. It's too hard to avoid messing up the subsequent instructions as well. \$\endgroup\$Martin Ender– Martin Ender2016年08月02日 09:42:24 +00:00Commented Aug 2, 2016 at 9:42
-
1\$\begingroup\$ 124 bytes: goo.gl/efSLKQ This is just your solution, but I've managed add a few additional substitutions, so that you only need to write out the alphabet once. Used the same strategy on similar problem as well. \$\endgroup\$Jakube– Jakube2017年09月10日 19:12:41 +00:00Commented Sep 10, 2017 at 19:12
-
1\$\begingroup\$ 122: goo.gl/zRsBbR \$\endgroup\$Jakube– Jakube2017年09月10日 19:17:31 +00:00Commented Sep 10, 2017 at 19:17
Emacs, 47 bytes
abcdefghijklmnopqrstuvwxyz^M
^P
<F3>
^K ^K ^Y ^Y
^P
^<space> ^F ^W ^E ^Y ^A
<F4>
^U 2 4 F4
Where ^P means "Control P", etc. That's 47 bytes, since the F3 and F4 keys require two ASCII bytes.
After entering the starting input, it defines a keyboard macro to duplicate the line and move the first character to the end. It then runs the macro a further 24 times.
-
3\$\begingroup\$ Welcome to PPCG, nice answer! It's very rare to see a Emacs answer, I don't even know if a Emacs answer already have been posted. \$\endgroup\$TuxCrafting– TuxCrafting2016年08月03日 12:59:34 +00:00Commented Aug 3, 2016 at 12:59
-
\$\begingroup\$ 43 bytes:
25..0|%{-join[char[]](90..65)[$_..($_-25)]}\$\endgroup\$Dorian– Dorian2021年07月13日 10:48:20 +00:00Commented Jul 13, 2021 at 10:48 -
\$\begingroup\$ @Dorian: Thanks; can also be combined with character ranges from later PowerShell versions (v6+, I think) to get rid of the
[char[]]. \$\endgroup\$Joey– Joey2021年07月13日 21:46:39 +00:00Commented Jul 13, 2021 at 21:46
Jelly, 7 bytes
ØAṙJṢj7
How it works
ØAṙJṢj7 Main link. No arguments.
ØA Set argument and return value to "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
J Yield the indices of the argument, i.e., [1, ..., 26].
ṙ Rotate the alphabet 1, ..., 26 units to the left.
This generates all rotations, but not in the correct order.
Ṣ Sort the rotated alphabets.
j7 Join, separating by linefeeds.
JavaScript (ES6), 56 bytes
_=>"ABCDEFGHIJKLMNOPQRSTUVWXYZ".replace(/./g,"$&$'$`\n")
Yes, that's right, half my code is the alphabet string literal. Best I could do without the literal is 81 bytes:
_=>[...Array(26)].map((_,i,a)=>a.map(_=>(i++%26+10).toString(36)).join``).join`
`
If you want a program rather than a function, then remove the _=> and wrap in console.log() for a cost of 10 bytes.
-
\$\begingroup\$ Woah, well done. A very elegant solution. How does it work? \$\endgroup\$Polyducks– Polyducks2016年08月08日 10:16:10 +00:00Commented Aug 8, 2016 at 10:16
-
2\$\begingroup\$ @Polyducks Lots and lots of regexp magic. Naturally
/./gmatches each letter of the supplied alphabet string. In the replacement string,$&represents the match itself,$'the part of the string after the match and$`the part of the string before the match.$`$&$'would therefore represent the original string, but of course it's trivial to move the part after the match to the beginning, thus providing the rotation effect. \$\endgroup\$Neil– Neil2016年08月08日 10:41:55 +00:00Commented Aug 8, 2016 at 10:41 -
\$\begingroup\$ Super smart! Well done @Neil! \$\endgroup\$Polyducks– Polyducks2016年08月09日 14:04:03 +00:00Commented Aug 9, 2016 at 14:04
C, (削除) 88 (削除ここまで) 64 bytes
Call f() without arguments.
f(i,j){for(i=j=0;i<26;putchar(j==26?j=0,i++,10:65+(i+j++)%26));}
Piet, 247 bytes/190 codels
So, this took far longer than I had anticipated, and I have a few ideas on some other more efficient (more stack-friendly) approaches, but I finally got the dang thing working (and fixed an interpreter bug and added IDE features along the way), so here it is. Hardly the most byte-efficient language, but a hell of a lot of fun. Here's a larger view, and a trace showing the path taken. History up on my GitHub.
Tabula Recta in Piet, large version
As a stack-based language, it's far too convoluted to explain briefly, but here's a basic overview of what the various sections/loops do. All variable and function names are just for explanation, as there are no variables or functions in Piet.
- Initialization (upper-left): starts
line_counterat 27, loads '@' ascur_letter, setsletter_countto 27 - Main loop (starting at dark purple, center top)
- Decrements
letter_counter - Branches to
reset_lineif zero (light cyan 2-block) - Rolls
cur_letterto the top of the stack - Branches to
check_doneifcur_letter > 'X'(teal/red block, right side) - Increments
cur_letterand outputs it (lower-right corner) - Branches to
reset_letterifcur_letter > 'Y'(light green block, left) - Rolls `letter_counter_ back to top of stack, back to top of loop
- Decrements
reset_linebranch (big pink square):- Outputs newline character
- Resets
letter_countto 27 - Continues back to top of main loop
check_donebranch (right half inside)- Rolls
line_counterto top - Branches to end if zero
- Decrements
line_counterand rolls back to bottom of stack - Resumes where it left off, printing letter
- Rolls
reset_linebranch (left side, green block):- Resets
cur_letterto '@' - Resumes where it left off, rolling/returning to top of loop
- Resets
Mathematica (削除) 68 (削除ここまで) 61 bytes
Column[""<>RotateLeft["A"~CharacterRange~"Z",#]&/@0~Range~25]
Thanks to...
@MartinEnder (7 bytes)
-
\$\begingroup\$ Also,
Arraymight be shorter that mapping over aRange. \$\endgroup\$Martin Ender– Martin Ender2016年07月30日 16:21:35 +00:00Commented Jul 30, 2016 at 16:21 -
\$\begingroup\$ I just checked and
Arraydoes indeed save a byte, but you can then save another by avoidingColumn:Array[{"A"~CharacterRange~"Z"~RotateLeft~#,"\n"}&,26,0]<>""(you'll just need to replace the\nwith an actual linefeed). \$\endgroup\$Martin Ender– Martin Ender2016年07月30日 16:31:20 +00:00Commented Jul 30, 2016 at 16:31 -
8\$\begingroup\$ Wait no built-in? Impossible \$\endgroup\$MC ΔT– MC ΔT2016年07月31日 13:35:25 +00:00Commented Jul 31, 2016 at 13:35
-
1\$\begingroup\$
Print@@@NestList[RotateLeft,"A"~CharacterRange~"Z",25]\$\endgroup\$alephalpha– alephalpha2016年08月01日 17:21:50 +00:00Commented Aug 1, 2016 at 17:21 -
\$\begingroup\$
Grid@Array[FromCharacterCode[Mod[+##-2,26]+65]&,{26,26}]\$\endgroup\$matrix42– matrix422017年07月28日 07:59:43 +00:00Commented Jul 28, 2017 at 7:59
MATL, 8 bytes
With thanks to @Dennis, who suggested that MATL should incorporate modular indexing, and to @Suever, who had the idea of automatic pairwise operations.
1Y2t&+Q)
1Y2 % Predefined literal: string 'AB...Z'
t % Push another copy of it
&+ % 2D array with all pairwise additions of ASCII code points from that string.
% Gives the ×ばつ26 array [130 131... 155; 131 132... 146; ...; 155 156... 180]
Q % Add 1 to each element. First entry is now 131, etc
) % Index into string 'AB...Z'. Since it has length 26 and MATL uses modular
% indexing, 131 is the first entry (character 'A'), etc. Implicitly display
Python 2, (削除) 75 (削除ここまで) (削除) 65 (削除ここまで) (削除) 61 (削除ここまで) 58 bytes
a='%c'*26%tuple(range(65,91))
for x in a:print a;a=a[1:]+x
Gets the alphabet with map(chr,range(65,91)), then manually applies the string shift operation.
Thanks to @LeakyNun and @TheBikingViking for -4 bytes!
Thanks to @xnor for -3 bytes!
-
2\$\begingroup\$ Apparently
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"is shorter. \$\endgroup\$Leaky Nun– Leaky Nun2016年07月30日 16:49:13 +00:00Commented Jul 30, 2016 at 16:49 -
1\$\begingroup\$ You can do
a[1:]instead ofa[1:26]. \$\endgroup\$TheBikingViking– TheBikingViking2016年07月30日 17:40:39 +00:00Commented Jul 30, 2016 at 17:40 -
2\$\begingroup\$ Your loop can be done as
for x in s:print s;s=s[1:]+x. \$\endgroup\$xnor– xnor2016年07月30日 21:09:07 +00:00Commented Jul 30, 2016 at 21:09 -
3\$\begingroup\$ You can do one byte shorter than hardcoding the alphabet:
s='%c'*26%tuple(range(65,91)). \$\endgroup\$xnor– xnor2016年07月30日 21:24:52 +00:00Commented Jul 30, 2016 at 21:24
R, (削除) 47 (削除ここまで) (削除) 42 (削除ここまで) 41 bytes
write(rep(LETTERS,27)[-27*1:26],1,26,,'')
Generates 27 alphabetes, removes 27-th letters and prints in 26 columns.
-
1
-
\$\begingroup\$ Wow, I thought I had tried every indexing trick to use
repbut this was particularly inspired! Very nice. I'd upvote again if I could. \$\endgroup\$Giuseppe– Giuseppe2018年02月01日 19:28:37 +00:00Commented Feb 1, 2018 at 19:28 -
\$\begingroup\$ you can use
1instead of""forstdout. \$\endgroup\$Giuseppe– Giuseppe2018年03月22日 19:02:08 +00:00Commented Mar 22, 2018 at 19:02
Javascript, (削除) 113 (削除ここまで) (削除) 96 (削除ここまで) (削除) 91 (削除ここまで) 76 bytes
A super-short version for running in the console:
l="ZABCDEFGHIJKLMNOPQRSTUVWXY";for(C=26;C--;console.log(l=l.slice(1)+l[0]));
Javascript/HTML, (削除) 140 (削除ここまで) (削除) 123 (削除ここまで) (削除) 118 (削除ここまで) 105 bytes
A prettier version, with an HTML output that makes it easier for OP to copy and paste:
<script>l="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(C=26;C--;document.write(l+"<br>"),l=l.slice(1)+l[0]);</script>
(EDIT: I should've just used the string A-Z instead of generating it)
(EDIT 2: Thanks to @Neil and @DanTheMan for their input (see comments))
-
\$\begingroup\$ Isn't the first C=26 irrelevant? \$\endgroup\$DanTheMan– DanTheMan2016年07月30日 21:57:07 +00:00Commented Jul 30, 2016 at 21:57
-
\$\begingroup\$ Oh snap. Looks like I forgot to delete it when I moved it to the for. Fixed! Thanks @DanTheMan :) \$\endgroup\$Polyducks– Polyducks2016年07月30日 22:00:48 +00:00Commented Jul 30, 2016 at 22:00
-
1\$\begingroup\$
l.slice(0,1)is justl[0], while the,27is unnecessary, at which point you can move the slice and end up withl.slice(1)+l[0]. Also I think you can move theconsole.logto the loop body thus avoiding the trailing;. \$\endgroup\$Neil– Neil2016年07月30日 22:46:14 +00:00Commented Jul 30, 2016 at 22:46 -
\$\begingroup\$ Testing this now, thanks @Neil! EDIT: Sweet holy moly. Thanks to you both, I'll add you to credit in the comment. \$\endgroup\$Polyducks– Polyducks2016年07月30日 22:48:46 +00:00Commented Jul 30, 2016 at 22:48
-
1\$\begingroup\$ Ooh, nice, that's an even better way of simplifying the
console.log. \$\endgroup\$Neil– Neil2016年07月30日 23:06:39 +00:00Commented Jul 30, 2016 at 23:06
Retina, (削除) 36 (削除ここまで) 31 bytes
5 bytes thanks to Martin Ender.
Z
{2`
$`
}T01`L`_L
\`.
$&$'$`¶
Leading linefeed is significant.
Sesos, (削除) 27 (削除ここまで) 25 bytes
0000000: 685902 ae7b33 764992 c45d9b 397360 8fef1f 7bca72 hY..{3vI..].9s`...{.r
0000015: 3adc33 07
Try it online! Check Debug to see the generated SBIN code.†
Sesos assembly
The binary file above has been generated by assembling the following SASM code.
add 26
jmp
jmp
rwd 1, add 1, rwd 1, add 1, fwd 2, sub 1
jnz
rwd 2, add 64
jmp
fwd 2, add 1, rwd 2, sub 1
jnz
fwd 1, sub 1
jnz
fwd 1
jmp
jmp
put, fwd 1
jnz
rwd 27
jmp
put, fwd 1
jnz
add 10, put, get, fwd 1
jmp
rwd 1, add 1, fwd 1, sub 1
jnz
fwd 1
; jnz (implicit)
How it works
We start by initializing the tape to ABCDEFGHIJKLMNOPQRSTUVWXYZ. This is as follows.
Write 26 to a cell, leaving the tape in the following state.
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 0
As long as the cell under the data head is non-zero, we do the following.
Copy the number to the two cells to the left and add 64 to the leftmost copy.
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 26 0 0
Move the leftmost copy to the original location, then subtract 1 from the rightmost copy.
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 90 0
The process stops after 26 iterations, since the rightmost copy is 0 by then. We move a cell to the right, so the final state of the tape after the initialization is the following.
v
0 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
Now we're ready to generate the output, by repeating the following process until the cell under the data head is zero.
First, we print the character under the data head and move to the right, repeating this step until a cell with value 0 is found. After printing ABCDEFGHIJKLMNOPQRSTUVWXYZ, the tape looks as follows.
v
0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
Now we move the data head 27 units to the left (back to the leading 0) and repeat the print-move combination until a cell with value 0 is found. This prints nothing and leaves the tape as follows.
v
0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
Now, we write 10 to the current cell, print the corresponding character (linefeed) and zero the cell with a call to get on empty input, leaving the tape unchanged.
Afterwards, we move the content of the cell to the right to the current cell, then move the data head to units to the right.
v
65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
The next iteration is slightly different. The first printing step prints BCDEFGHIJKLMNOPQRSTUVWXYZ, leaving the tape as follows.
v
65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
Now we move the data head 27 units to the left.
v
65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
The subsequent printing loop prints A and leaves the tape as follows.
v
65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
Once again, we print a linefeed, move the content of the cell to the right to the current cell, then move the data head to units to the right.
v
65 66 0 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
After 24 more iterations, the final step of moving the data head to the right leaves the tape in the following state.
v
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 0
The cell under the data head is now 0 and the program terminates.
† TIO uses a newer version of Sesos, which is backwards-compatible for SASM, but generates shorter SBIN code.
Haskell, (削除) 56 (削除ここまで) (削除) 53 (削除ここまで) 52 Bytes
mapM(\x->putStrLn$init$[x..'Z']++['A'..x])['A'..'Z']
same length: (using a suggestion by @AndersKaseorg)
a=['A'..'Z']
mapM putStrLn[take 26$[x..'Z']++a|x<-a]
to do modular stuff you have to import Data.Char to get the chr function, (削除) 74 (削除ここまで) (削除) 59 (削除ここまで) 58 Bytes was the best I could get with that: (thanks to @nimi for suggesting the toEnum function)
a=[0..25]
mapM(\x->putStrLn[toEnum65ドル+(x+y)`mod`26|y<-a])a
This could probably be much shorter, but I don't know any Haskell golfing tricks.
used mapM instead of mapM_ (see @Lynn's comment)
-
1\$\begingroup\$ For −3 bytes, change
['A'..x]to['A'..'Z'], which is now used twice, and lift that to a definition. \$\endgroup\$Anders Kaseorg– Anders Kaseorg2016年07月30日 20:38:08 +00:00Commented Jul 30, 2016 at 20:38 -
\$\begingroup\$ @AndersKaseorg: Thanks! However, I got another idea which saved the same number of bytes while keeping it a oneliner. I added your suggestion to the alternative solution, though. \$\endgroup\$KarlKastor– KarlKastor2016年07月30日 22:14:25 +00:00Commented Jul 30, 2016 at 22:14
-
\$\begingroup\$ If you only need
chrfromData.Char, you can usetoEnuminstead and omit theimport. \$\endgroup\$nimi– nimi2016年07月30日 22:51:36 +00:00Commented Jul 30, 2016 at 22:51 -
1\$\begingroup\$ I feel like changing
mapM_tomapMshould be fine. Maybe this is worth a meta post... \$\endgroup\$lynn– lynn2016年07月31日 08:12:13 +00:00Commented Jul 31, 2016 at 8:12
R, 53 bytes
for(i in 1:26)cat(LETTERS[c(i:26,1:i-1)],"\n",sep="")
Here it is on an online interpreter.
V, (削除) 36 (削除ここまで), 10 bytes
¬AZ25ñÙx$p
This uses the "Latin1" encoding.
Explanation:
¬AZ " Insert the alphabet
25ñ " 25 times...
Ù " Duplicate this line
x " Cut the first character
$p " Move to the end of the line and past the character we just cut
-
\$\begingroup\$ Go and add it then ;) \$\endgroup\$Conor O'Brien– Conor O'Brien2016年08月04日 07:36:04 +00:00Commented Aug 4, 2016 at 7:36
-
\$\begingroup\$ @CᴏɴᴏʀO'Bʀɪᴇɴ You should know by now that the only way anything gets done in this language is at a snails pace. I'll probably have that up and running sometime next January. :P \$\endgroup\$DJMcMayhem– DJMcMayhem2016年08月04日 09:25:56 +00:00Commented Aug 4, 2016 at 9:25
-
\$\begingroup\$ Oh, in the next 6-8 weeks? \$\endgroup\$Conor O'Brien– Conor O'Brien2016年08月04日 18:00:08 +00:00Commented Aug 4, 2016 at 18:00
Dyalog APL, (削除) 10 (削除ここまで) 11 bytes
(↑⍳∘⍴⌽ ̈⊂)⎕A
Requires ⎕IO←0 which is standard on many systems.
The generalized 7-char function is just ↑⍳∘⍴⌽ ̈⊂:
↑ make the following list of strings into a character table:
⍳the indices
∘ of
⍴ the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
⊂ the entire argument
With the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:
f←↑⍳∘⍴⌽ ̈⊂
×ばつo+
In fact, even strings and numbers are allowed:
f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────┬───────┬───────┬───────┐
│Alpha │Bravo │Charlie│Delta │
├───────┼───────┼───────┼───────┤
│Bravo │Charlie│Delta │Alpha │
├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo │
├───────┼───────┼───────┼───────┤
│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
f⍳8
0 1 2 3 4 5 6 7
1 2 3 4 5 6 7 0
2 3 4 5 6 7 0 1
3 4 5 6 7 0 1 2
4 5 6 7 0 1 2 3
5 6 7 0 1 2 3 4
6 7 0 1 2 3 4 5
7 0 1 2 3 4 5 6
-
1\$\begingroup\$ My solution is the same length, but much simpler and doesn't rely on ⎕IO←0: ↑⌽∘⎕A¨0,⍳25 \$\endgroup\$Vadim Tukaev– Vadim Tukaev2022年07月12日 17:37:44 +00:00Commented Jul 12, 2022 at 17:37
-
1\$\begingroup\$ @VadimTukaev Very nice. Does rely on
⎕IO←1though. \$\endgroup\$Adám– Adám2022年07月12日 18:14:46 +00:00Commented Jul 12, 2022 at 18:14
Brain-Flak, 222 bytes
(((()()()()){})<(((({}){}){}){})>)((((([[]]{}){}()){}))<>()){<>({}<>)<>{({}<(({}()))>[()])}{}<>([({})]<>{})<>(({}<>))<>({}[()])}{}<>(({}<>))<>{}{}{}<>{({}<(({}())[()]<{({}<<>({}<>)>[()])}{}{}((()()()()()){})>)>[()])}{}{}{}
I'm new to Brain-Flak, so maybe this can be golfed a lot, but at least it's a first try. It stores 27 full alphabets on the left stack, then moves the alphabets to the right and replaces every 27th letter by a newline.
My sourcecode is a bit confusing, but i will add it nevertheless.
(((()()()()){})
park 8 in third
<(((({}){}){}){})> push 64
)
((((([[]]{}){}()){}))<>()) push 26 twice on left and 27 on right
left stack: 64 letter, 26 letter count, 26 constant
right stack: 27 alphabet count
{ while alphabet count
<>
({}<>)<> push 26 back to right
{ while counter
(
{} park counter in third
<(({}()))> add next letter to stack
[()] decrement counter
)
}
{} pop 0 counter
<>([({})]<>{}) set Z back to A-1
<>(({}<>)) move 26 twice from right to left
<> go to right stack
({}[()]) decrement counter
}
{} pop 0
<>(({}<>)) push 26 twice on right stack
<>{}{}{} pop counter, @ and Z from left stack
<> go to right stack
{ while alphabet count
(
{} save alphabet count on third stack
<(
({}())[()] save constant on third stack and push lettercount 26 + 1 for lf
<
{ while lettercount
(
{} save lettercount on third stack
<
<>({}<>) pull letter from left to right
>
[()] decrement lettercount
)
}
{} pop 0
{} pop last letter
((()()()()()){}) push lf
>
)>
[()] decrement alphabet count
)
}
{}{}{} pop alphabet count, constant and lf
C#, 98 bytes
I have tried to see if I can generate the letters shorter than just initializing them as a string, but it's not really possible. The letters are 26 bytes and this snippet alone
for(char a='A';a<'[';a++)
is 25 bytes. I think initializing them and then appending them with a+=a is a good solution, but with C# you are limited by the bytecount of functions like Substring() and Console.WriteLine().
My attempt at 98 bytes:
var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ";a+=a;for(int i=0;i<26;i++)Console.WriteLine(a.Substring(i,26));
Octave, 27 bytes
We're adding a row and a column vector, and Octave nicely expands the sigleton dimensions, no need for bsxfun (as you would need in Matlab).
[mod((v=0:25)+v',26)+65,'']
q, 20 bytes
(til 26)rotate\:.Q.A
-
1\$\begingroup\$ 14 bytes
-1_'26 27#.Q.A\$\endgroup\$mkst– mkst2018年07月05日 19:08:45 +00:00Commented Jul 5, 2018 at 19:08
Java, (削除) 190 (削除ここまで) (削除) 176 (削除ここまで) (削除) 172 (削除ここまで) 163 bytes
class C{public static void main(String[] a){int s=0;while(s<26){p(s,26);p(0,s++);p(-1,0);}}static void p(int s,int e){for(;s<e;s++)System.out.write(s<0?10:65+s);}}
-
\$\begingroup\$ You can easily shave off some more bytes:
System.out.printf("%c", ...)->System.out.write(...),'\n'->10,'A'->65. Note sure the newline/line feed char suggestion is allowed, but ideone output requirement. :) \$\endgroup\$MH.– MH.2016年07月31日 13:34:15 +00:00Commented Jul 31, 2016 at 13:34 -
\$\begingroup\$ @MH. great tips! saved 9 bytes :) \$\endgroup\$Master_ex– Master_ex2016年07月31日 14:19:50 +00:00Commented Jul 31, 2016 at 14:19
-
\$\begingroup\$ I know it's been more than a year since you've answered this, but you can still golf a few things: The space at
String[]acan be removed; andint s=0;while(s<26){p(s,26);p(0,s++);p(-1,0);}can befor(int s=0;s<26;p(0,s++),p(0,s++))p(s,26);. \$\endgroup\$Kevin Cruijssen– Kevin Cruijssen2017年09月18日 09:58:05 +00:00Commented Sep 18, 2017 at 9:58
Bash, 66 bytes
A=`printf %c {A..Z}`
for i in {0..25};do echo ${A:$i}${A::$i};done
I create a full alphabet in A, then print 26 rotated versions of it by taking the characters beginning at n and appending those preceding position n.
printf, we need to includestdio.h, ifisalphais used,ctype.his needed, etc. Is this correct? \$\endgroup\$