# Print the Russian Cyrillic alphabet [duplicate]

Apparently, we really like printing the alphabet in different languages.

How about the Russian Cyrillic alphabet?

Print/output/return this exact text (trailing whitespace is permitted)

АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя


This is the Russian Cyrillic alphabet with upper and lower case interleaved (eg AaBbCc...)

This is so crunch those bytes folks!

• @EriktheOutgolfer This Unicode order of these make for a very different challenge.
Jun 21, 2017 at 10:31
• Is outputting an array of individual characters permitted? Jun 21, 2017 at 11:16
• For Ёё, may we output codepoints U+00CB and U+00EB instead of U+0401 and U+0451? Jun 21, 2017 at 17:04
• @ETHproductions no, the text must be outputted exactly Jun 21, 2017 at 17:14
• Do we have to use Unicode? Or can we use an 8-bit Cyrillic encoding? Jun 22, 2017 at 13:43

# Рапира (Rapira), 172 142 bytes

ВЫВОД: "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"


Try it online!

Just for fun, given the challenge. It may not be golfed; I'm not really familiar with the language.

• @user202729 That's because it was a function definition that was never called, and there was a typo. It works now. Dec 9, 2017 at 18:33

# Mathematica, 43 42 bytes

Alphabet is a built-in function.

-1 byte from Martin.

ToUpperCase@#<>#&/@Alphabet@"Russian"<>""&


This may not work on some older versions of Mathematica, but it does work on Wolfram sandbox and Try it online!.

Another version without builtin Alphabet or ToUpperCase:

# Mathematica, 82 66 bytes (64 chars)

Insert[FromCharacterCode@{#,#+32}&/@(1039+Range@32),"Ёё",6]<>""&


or

Insert[FromCharacterCode@{#,#+32}&/@1040~Range~1071,"Ёё",6]<>""&


Unfortunately Martin's trick (use a<>b instead of {a,b}) doesn't work here.

Try it online!

• Of course Alphabet is a built-in. Freaking goats is a built-in. Jun 21, 2017 at 12:18
• @Downvoters Well, don't downvote this just because it's over-upvoted. It's a completely valid answer, and not overly boring, eithre. I hate seeing my reputation being "fractional"... Dec 9, 2017 at 2:48
• For what it's worth, I didn't downvote. There shouldn't be a punishment for knowing a built-in. Dec 10, 2017 at 21:43

# Jelly, 18 bytes

40r71s6j25Q+ȷỌżŒl$ A full program. Pretty similar in nature to an existing answer by Erik the Outgolfer, but I think it's different enough. Try it online! ### How? 40r71s6j25Q+ȷỌżŒl$  Main link: no arguments
40r71               inclusive range from 40 to 71: [40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]
s6             split into sixes: [[40,41,42,43,44,45],[46,47,48,49,50,51],[52,53,54,55,56,57],[58,59,60,61,62,63],[64,65,66,67,68,69],[70,71]]
j25          join with 25s: [40,41,42,43,44,45,25,46,47,48,49,50,51,25,52,53,54,55,56,57,25,58,59,60,61,62,63,25,64,65,66,67,68,69,25,70,71]
Q         de-duplicate: [40,41,42,43,44,45,25,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]
ȷ       literal 1000
Ọ      cast to characters: "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"
$last two links as a monad: Œl lowercase: "абвгдеёжзийклмнопрстуфхцчшщъыьэюя" ż zip: ["Аа","Бб","Вв","Гг","Дд","Ее","Ёё","Жж","Зз","Ии","Йй","Кк","Лл","Мм","Нн","Оо","Пп","Рр","Сс","Тт","Уу","Фф","Хх","Цц","Чч","Шш","Щщ","Ъъ","Ыы","Ьь","Ээ","Юю","Яя"] implicit print: АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя  • I think it's different enough too, not because of +ȷ but because of the s6(...)Q approach. Jun 21, 2017 at 12:23 • Thanks @EriktheOutgolfer - I created it, then saw yours and almost commented to give the improvement. Jun 21, 2017 at 12:25 • BTW I'm incorporating the improvement, but keeping my approach for 19 bytes. Jun 21, 2017 at 12:26 # C#, Java, Javascript 137 bytes Note: Java is only valid if you replace => with -> s=>"АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"  Ahhhh!!! Found a shorter way for # C#, 102 99 bytes a=>string.Concat(new string[32].Select((x,i)=>(x=(char)(i+1040)+"")+x.ToLower())).Insert(12,"Ёё")  Shortened it by using a different approach Try it Online! • What encoding is this? Pretty sure it's 138 bytes. – Okx Jun 21, 2017 at 10:33 • This is 138 bytes. Also, replace () with a single character to save a byte. Jun 21, 2017 at 10:33 • @Shaggy Sorry misread the TIO, question doesn't specify that unused parameters are allowed but I will edit them in Jun 21, 2017 at 10:34 • In UTF-8 this is 138 bytes, but 72 characters Jun 21, 2017 at 10:34 # Japt, 7538322423 22 bytes ;Bi";<=>?@," c+981 ®+v  Test it • 1 byte saved thanks to ETHproductions. ## Explanation ;B :The uppercase alphabet i :Prepend ... ";<=>?@," : this string c :Map over the charcodes of each character in the string... +981 : and increment them by 981 ® :Map over each character in the string, replacing them with themselves... +Zv : and their lowercase selfs :Implicit output of resulting string  ## History • I think this works: ethproductions.github.io/japt/… Jun 21, 2017 at 14:50 • @obarakon; nice one. But Ё & ё are missing. Also, you can save a couple of bytes with multiline and small tweak: ethproductions.github.io/japt/… EDIT: See you got those improvements already. Jun 21, 2017 at 14:53 • That's what I did in my edit :P And darn Ёё. You can do i"Ёё"B but that would cost too many bytes. Jun 21, 2017 at 14:56 • Adding Ãi'ЁB to the end of the first line would be a byte shorter: ethproductions.github.io/japt/… Jun 21, 2017 at 14:58 • I think you'd have to do Ãi'Ё6, but yeah good idea. Jun 21, 2017 at 15:01 # Jelly, 20 19 bytes 71r40s26j25+ȷṚỌżŒl$


Try it online!

Thanks to Jonathan Allan for posting his answer (even though he outgolfs me) for -1 :)

• Since Jelly's code page does not have the Cyrillic alphabet, don't you need to count the bytes in UTF-8? I might be misunderstanding something. Jun 21, 2017 at 12:21
• @ComradeSparklePony The output codepage doesn't have to do with the code codepage. Jun 21, 2017 at 12:22

## PHP, 68 66

for(;$i++<33;)echo$c=ڀ^"
".chr($i-7?16+$j++:1),mb_strtolower($c);  slight improvement over the previous attempt by xoring instead of appending. ڀ^"\n" constructs the necessary "\0xd0\128" and xors in the lower 7 bit. • Cool 'for' loop. Never seen that in my life. Jun 22, 2017 at 0:59 ## JavaScript (ES6), 106 bytes f= _=>"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ".replace(/./g,c=>c+c.toLowerCase()) console.log(f()) # 05AB1E, 22 bytes žv47ŸžB+çJ6т‚£'ЁýDløJ  Try it online! Explanation žv47Ÿ # push range [16 ... 47] žB+ # add 1024 to each çJ # convert to a string of characters with those code points 6т‚£ # split into 2 pieces, the first being 6 chars long 'Ёý # merge the 2 strings on "Ё" Dlø # zip with a lower case copy J # join to a string  • Oh, wow, I didn't even see you had an answer posted; let alone that there were 4 05AB1E answers already lol. Jun 21, 2017 at 14:51 • AND l WORKS ON RUSSIAN ALPHABETS?! WHAT. Jun 21, 2017 at 15:00 • @carusocomputing: Hehe, yeah. Pretty practical :P Jun 21, 2017 at 15:01 # Pyth, 26 bytes X12ssmCM+B+1040d32U32"Ёё   U32 generate the range [0, 1, 2, ..., 30, 31] m d for each element in the range, +1040 add 1040, giving the uppercase cyrillic letter +B 32 bifurcate over adding 32, giving [upper, lower] CM convert each into a character ss join into a single string X12 "Ёё insert this string at index 12  • Because the output is different. Jun 21, 2017 at 10:42 • @LeakyNun Ah, TIO seems to have mangled the encoding. It does work locally, however. Jun 21, 2017 at 10:43 • Ñ doesn't belong there... Jun 21, 2017 at 10:43 • @LeakyNun I've changed the link to the other online Pyth interpreter, which runs it correctly. Jun 21, 2017 at 10:45 • You can save 2 bytes with rB ... Z: X12ssmrBC+1040dZU32"Ёё Jun 22, 2017 at 6:03 # 05AB1E, 20 bytes = 18 bytes + 2 UTF-8 bytes T„(GÇ«ŸçJ„ЁЖ6ǝDløJ  Try it online! Credit to Emigna for the lowercase trick and for 3° isntead of 3Tm. # How? T # Push 10. | [10] „(G # Push "(G" | [10, "(G"] Ç # Convert to ASCII. | [10, [40, 71]] « # Concatenate. | [[1040, 1071]] Ÿ # Range. | [[1040, ..., 1071] çJ # Convert to char, join. | ["А..Я"] „ЁЖ # Push "ЁЖ" | ["А..Я", "ЁЖ"] 6ǝ # Replace "Ж" w/ "ЁЖ" | ["А.Ё.Я"] Dl # Duplicate, lowercase. | ["А..Ё..Я", "а..ё..я"] øJ # Zip together and join. | ["АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"]  Alternate 20 byte version (no UTF-8): T„(GÇŸ„.Ç6ǝ˜«çJDløJ Even more random 20 byte nonsense: T„(GÇŸ„.Ç6ǝ˜«vyçDlJ (The key takeaway is that I don't think I'm getting below 20 here). • @Emigna figures I missed the hard part of the challenge heh... Jun 21, 2017 at 14:45 • @Emigna none of my answers would be valid without you ._. lol. Jun 21, 2017 at 15:21 • Nice trick with T and «! Jun 21, 2017 at 15:24 • @Emigna took a minute, knew there was something I could to to make 40 79 not awful. Jun 21, 2017 at 15:26 • @ETHproductions the two alternate ones use no UTF-8. Jun 21, 2017 at 17:11 # Braingolf, 58 bytes "ABCDEF2GHIJKLMNOPQRSTUVWXYZ[\\]^_"{#Ϗ+..#Ёe#P:# |+}>&@  Try it online! Woo! ## Explanation Adds Ϗ (975) to each character in ABCDEF2GHIJKLMNOPQRSTUVWXYZ[\]^_ Then duplicates and adds space (32), unless the character is Ё, in which case it adds P (80) • Would it shave a byte to duplicate and test before adding Ϗ, since Ё is two bytes? I'm assuming UTF-8 - is that what's here? Jun 21, 2017 at 15:05 • @TobySpeight no because we're checking if the original value plus Ϗ is Ё, and yes, Braingolf uses UTF-8 Jun 21, 2017 at 15:09 • My thinking was if we test before adding Ϗ, then that's a test against 2 (1 byte) rather than against Ё (2 bytes). Jun 21, 2017 at 15:31 • @TobySpeight we have to duplicate before pushing the space or P though, otherwise it'll cost us a byte to swap the values Jun 21, 2017 at 16:47 • Ah, I see. You already have my vote, anyway. Jun 21, 2017 at 16:49 # Java, 93 bytes s->"АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"  Source file should be saved in Windows-1251 encoding so the source makes for 71 bytes, plus flag to compiler -encoding WINDOWS-1251 for 22 bytes more. • Beaten to it Jun 21, 2017 at 11:44 • @Shaggy Well, I would've posted an idea to use different encoding there as a comment, but that answer was intended for 3 languages, and the flag to the compiler is specific to Java, so I posted this as a separate answer. Jun 21, 2017 at 11:48 • Also, you don't need to specify the flag. Since Windows-1251 is the default charset on Russian Windows (and javac always uses the default charset by default). Just mention that and you're good with only 71 bytes. But my answer even beats that ;) Jun 22, 2017 at 9:52 # Python 3, 69 66 bytes -3 bytes using the form (using '%c' to directly apply chr()) from totallyhuman's answer, do go give some credit! v=32 while v:print('Ёё'*(v==26),end='%c%c'%(1072-v,1104-v));v-=1  A full program (two double-byte characters used, Ё and ё). Try it online! • Heh... I thought my answer looked different enough until I just actually read your code and turns out I just reversed the order. >_> Jun 24, 2017 at 14:44 # Dyalog APL, 55 47 bytes 8 bytes saved thanks to @Zacharý ⎕UCS 66⍴⍉2 33⍴1025+(14+⍳6),0,(20+⍳32),80,52+⍳26  Try it online! # Pyth, 71 bytes ."Ёё kdâ¿Ããä©ÃòçÅD´fjÃØÜr ÔE®8CðÒº[£÷6ÓþC0"  Try it online! # 05AB1E, 6447 46 bytes 5ÝD1040+s1072+‚øžB>D80+‚«25ÝD1046+s1078+‚ø)˜çJ  Try it online! • You can save a byte by using žB> instead of 1025 Jun 21, 2017 at 10:44 • @Datboi True, but the 20 byte Jelly solution makes me sad. – Okx Jun 21, 2017 at 10:47 • @Okx there's a 22 byte 05AB1E solution ;). Jun 21, 2017 at 14:46 # C# (.NET Core), 94 93 90 bytes _=>{var r="";for(var i='А';i<='Я';)r+=""+i+(char)(i+32)+(i++=='Е'?"Ёё":"");return r;}  Try it online! # Python 3, 96 92 bytes • @Mayube suggested this to save 2 bytes, and succeeded to golf it down by 1 byte by declaring chr(i). • @Rod golfed 4 bytes by removing chr(i). for i in[chr(ord(i)+975)for i in"ABCDEF2GHIJKLMNOPQRSTUVWXYZ[\\]^_"]:print(end=i+i.lower())  Try it online! # Python 3, 104 99 bytes Any suggestions are welcome. for i in"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ":print(end=i+i.lower())  Try it online! • With map(chr,range(65,91)) you have "ABC..Z" in 21 byte instead of 29. // So we have: i in map(chr,range(65,91))+"[\\]^_'" (37byte) vs i in"ABCDEF2GHIJKLMNOPQRSTUVWXYZ[\\]^_" (40byte). Jun 21, 2017 at 12:01 • @P.Siehr note the problematic Ё and hence the 2 placed between F and G, which mapping chr over range does not yield (see my Python answer for a different workaround). Jun 21, 2017 at 12:30 • @JonathanAllan I didn't notice that - sorry. But here is another solution for your Python3 version: print(*[i+i.lower() for i in"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"]), if whitespaces are ok in the output. TIO (-1 Byte) Jun 21, 2017 at 13:00 • @P.Siehr that is 98 bytes due to Python using UTF-8 encoding. White space is only allowed after the text in this challenge too (usually Kolmogorov-complexity challenges only allow an optional trailing newline). Jun 21, 2017 at 13:11 # 05AB1E, 29 bytes 1040ÐU5+ŸžB>X6+D25+Ÿ)˜çDl)ø˜J  Try it online! Uses the lowercase / uppercase trick from the python answer ### Explanation 1040ÐU5+ŸžB>X6+D25+Ÿ)˜çDl)ø˜J 1040 # Push 1040 Ð # Triplicate top of stack U # Saves top of stack in X 5+Ÿ # Push range [1040, ..., 1045] žB> # Push 1025 X # Push X (1040) 6+D25+Ÿ # Push range [1046, ..., 1071] ) # Wrap stack to array ˜ # Flatten array ç # Convert to character Dl # Create a lowercase copy )ø # Zip both together ˜J # Flatten and join # Implicit output  # Python 3, 66 bytes for i in range(32):print(end='%c%c'%(i+1040,i+1072)+'Ёё'*(i==5))  Try it online! # PHP>=7.0, 77 Bytes for($t=IntlChar;$i++<33;)echo$c=$t::chr($i-7?1040+$j++:1025),$t::tolower($c);  IntlChar Class # PHP, 136 Bytes for(;$i<mb_strlen($r=АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ);)echo$m=mb_substr($r,$i++,1),mb_strtolower($m);  PHP Sandbox Online # PHP, 136 bytes <?=АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя;  Try it online! • Currently at 68 byte :) Jun 21, 2017 at 12:17 • @Christoph nice idea Jun 21, 2017 at 13:02 # Bash+coreutils, 1011009392 74 bytes printf %b\\n \\u04{51,{3,4}{{0..9},{a..f}}}|sort|sed 's/./\u&&/'|tr -d \\n  This requires a UTF-8 locale such as ru_RU.utf8 (English UTF-8 locales also sort correctly). I've not added any score for this, as per the consensus on meta. # Ruby, 60 bytes u=?Џ l=?Я 32.times{$><<u.next!+l.next!+(l==?е?"Ёё":"")}


(Just a demonstration of String#next!, the multibyte literals ruin the 55 characters score.)

Sample run:

bash-4.4$ruby -e 'u=?Џ;l=?Я;32.times{$><<u.next!+l.next!+(l==?е?"Ёё":"")}'
АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя


Try it online!

# Ruby, 59 56 55 54 51 bytes

32.times{|x|\$><<((x==6?"Ёё":"")<<x+1040<<x+1072)}


Thanks to manatwork for at least 4 bytes.

Try it online!

# Japt, 26 24 bytes

22 bytes of code (encoded in UTF-8), +2 for the -P flag.

#h0o#k2_dÃi'Ё6
®+Zv


Similar to the below method, except instead of pairing two arrays, I join each capital letter with itself, lower-cased.

Try it Online!

## 26 byte solution:

I had some help from @Shaggy, who discovered that Ё wasn't in the [1040...1071] char range.

#h0o#k2_dÃi'Ё6
íUmv)c


## Explanation:

#h0o#k2_dÃi'Ё6
íUmv)c
// Implicit U =
o               //   Range
#h0                //     [1040...
#k2            //             1071]
_           //   Map; At each char,
d         //     Get the char-code
Ã        //   End mapping;
i'Ё6    //   Insert "Ё" into index 6;
í                  // U paired with:
Um                //   U, where each char:
v               //   Converted to lowercase
c             // Flatten
-P                 // Join into a string


Try it online!

# Charcoal, 4544 26 bytes

ＦＥ⮌⪫⪪…⮌…γ⁷²¦³²Ｌαi℅⁺℅ιφ⁺↥ιι


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

ＦＥ⮌⪫⪪…⮌…γ⁷²¦³²Ｌαi


Take the first 72 printable ASCII characters, reverse them, then take the first 32 of those (this is actually shorter than slicing and reversing, although slicing didn't exist at original time of posting anyway), then insert the i after the N, then reverse again. The resulting characters happen to have ASCII codes that are exactly 1000 less than the desired Russian lower case letters.

  ℅⁺℅ιφ


Calculate the Russian lower case letter by adding the predefined variable φ (f) which has the value 1000.

    ⁺↥ιι


Print the upper and lower case letters. («↥ιι would probably also work.)

## Alice, 31 bytes

gr'v6R,' &w'ѷ~-.O' +'С'ёSOk@


Try it online!

### Explanation

g       Read the first character of the source code. That's g itself, with
code point 103, so this pushes 103. The exact value is irrelevant
but we need something greater than 31.
r       Range. Turns 103 into 0, 1, 2, ..., 103.
'v      Push 118.
6R,     Move it down the stack by 6 elements, so the top of the stack is
..., 96, 97, 118, 98, 99, 100, 101, 102, 103.
' &w    Push the current IP address to the return address stack 32 times,
which will cause the following part to be executed 33 times.

'ѷ~-    Subtract the value on top of the stack from 1143, which gives the
33 code points of the upper case letters.
.O      Print a copy of this value as a character.
' +     Add 32. This turns the upper case letters in the main range to their
lower case counterparts. However, this doesn't work for Ё/ё, where
'C'ёS   Replace the divisor 1057 with 1105. The only value among the 33 which
is divisible by 1057 is 1057 (C) itself, so that it simply gets turned into
1105 (ё).
O       Output the lower case character.

k       Jump back to the w as long as there's a copy on the return address stack.
@       Terminate the program.


# Java (OpenJDK 8), 91 88 bytes

()->{String s="";for(char i=0,u=1039,l=1071;i<33;)s=i++==6?s+"Ёё":s+ ++u+ ++l;return s;}


Try it online!

Encoded in Windows-1251. Must use a default Russian Windows installation.

• You're Missing Ёё Jun 22, 2017 at 9:53
• @Mayube Fixed, for a great amount of extra bytes :( Jun 22, 2017 at 10:15
• You can do i++ and change the code accordingly to save 2 bytes: ()->{String s="";for(char i=0,u=1040,l=1072;i<33;i++)s=i==5?s+"Ёё":s+ ++u+ ++l;return s;} Jun 22, 2017 at 10:19
• Indeed, i is only a counter. I intended to use it otherwise at first. Jun 22, 2017 at 10:19

## Alice, 33 bytes

/ZАе"е"ёяSr@
\"'Я"rЁа""o/


Try it online!

My other Alice solution was entirely in Cardinal mode, this one is entirely in Ordinal mode. It's conceptually much simpler, but unfortunately two byte longer.

### Explanation

Ignoring the Ordinal template, the program is entirely linear:

"АЯ"r"ая"rZ'е"еЁё"So@


Alice does have a built-in to convert between lower and upper case, but unfortunately in the Ruby interpreter it only works on ASCII letters, so we still have to get both ranges separately.

"АЯ"r     Push "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ".
"ая"r     Push "абвгдежзийклмнопрстуфхцчшщъыьэюя".
Z         Zip. Interleave the two strings.
'е"еЁё"S  Replace "е" with "еЁё".
o@        Print the result and terminate the program.