# Letters challenge

Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line.

So the end-result becomes:

cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn

• Cccccccccc Oooooooooooo Nnnnnnnnnnnnnn And so on the solution should be displaced like that. There should be new line after every character is printed n times Commented Oct 2, 2018 at 10:11
• Welcome to PPCG! I have update the challenge text to reflect your comment above (specifications should be in the post not in the comments). I also fixed up the grammar a little. Feel free to edit it more. Commented Oct 2, 2018 at 10:17
• The less characters the better. Commented Oct 2, 2018 at 10:31
• What is the smallest number of characters that could be used to solve this problem using python? Commented Oct 2, 2018 at 13:14
• Don't know if this is of use for anyone, but conemon is rot10(seduced). Commented Oct 2, 2018 at 13:35

# R, 5047 45 bytes

This is some serious R abuse. I create a quote R expression C(O,N,E,M,O,N) and feed it into the string repeat function strrep, which kindly coerces each name inside the quote into a string. Shorter than scan !

write(strrep(quote(C(O,N,E,M,O,N)),5:11*2),1)


Try it online!

• That deserves its own tip. Commented Oct 4, 2018 at 13:07

# Python 2, 36 bytes

i=8
for c in'conemon':i+=2;print c*i


Try it online!

• cccccccccc oooooooooooo nnnnnnnnnnnnnn And so on the solution should be displayed like above Commented Oct 2, 2018 at 10:12
• @Monolica Fixed Commented Oct 2, 2018 at 10:17
• who would be able to improve this python code to a shorter code. i=8 for c in'conemon':i+=2;print c*i Commented Oct 2, 2018 at 11:10
• @Monolica FYI standard practice on PPCG is to wait quite some time (e.g. 1 week) before accepting an answer. Furthermore, for code-golf many question-posers don't ever actually accept any answer. If you are going to accept an answer, however, it should be the shortest code in bytes, since that is the winning criteria given by code-golf (given two of the same length it would be usual to accept the first to reach such a byte-count). Commented Oct 2, 2018 at 11:24

# K (ngn/k), 20 19 bytes

(2*5+!7)#'"conemon"


Try it online!

# 05AB1E, 16 14 bytes

.•Ω‡h₅•Sā·8+×»


-2 bytes thanks to @Emigna.

Try it online.

Explanation:

.•Ω‡h₅•           # Push "conemon"
S          # Convert it to a list of character: ["c","o","n","e","m","o","n"]
ā         # Push a list in the range [1, length]: [1,2,3,4,5,6,7]
·        # Double each: [2,4,6,8,10,12,14]
×     # Repeat the characters that many times
»    # Join the list by newlines (and output implicitly)


See this 05AB1E tip of mine (section How to compress strings not part of the dictionary?) to understand why .•Ω‡h₅• is "conemon".

• .•Ω‡h₅•Sā·8+×» for 14. Commented Oct 2, 2018 at 10:35
• @Emigna I was just looking for a way to remove that map. Smart way with ā·, thanks! Commented Oct 2, 2018 at 10:40

# Java 11, 78 bytes

v->{int i=8;for(var c:"conemon".split(""))System.out.println(c.repeat(i+=2));}


Try it online. (NOTE: String.repeat(int) is emulated as repeat(String,int) for the same byte-count, because Java 11 isn't on TIO yet.)

Explanation:

v->{                     // Method with empty unused parameter and no return-type
int i=8;               //  Integer i, starting at 8
for(var c:"conemon".split(""))
//  Loop over the characters (as Strings) of "codemon"
System.out.println(  //   Print with trailing new-line:
c.repeat(          //    The current character repeated
i+=2));}         //    i amount of times, after we've first increased i by 2


# Javascript, 55 52 bytes

saved 3 bytes thanks to @Arnauld

s=>[...'conemon'].map(x=>x.repeat(i+=2),i=8).join



f=s=>[...'conemon'].map(x=>x.repeat(i+=2),i=8).join

console.log(f());

• This is a kolmogorov-complexity challenge which doesn't take any input, so you'll have to hardcode 'conemon' within the code. On the good news side, you don't need to include f= in your byte count, unless the function is referring to itself -- which is not the case here. Commented Oct 2, 2018 at 12:18
• Hi. Welcome to PPCG. Quick note, you dont need to count f= bytes unless you use recursion so you answer is actually 47 bytes length Commented Oct 2, 2018 at 12:19
• Thank's for the clarification! I updated my answer.
– zruF
Commented Oct 2, 2018 at 12:34

# Japt-R, 13 bytes

¬¶n¬Ë²p5+E


Try it

## Explanation

¬¶n¬Ë²p5+E
¬¶n            :Compressed string "conemon"
¬           :Split
Ë          :Map each character at 0-based index E
²         :  Repeat twice
p5+E     :  Repeat 5+E times
:Implicitly join with new lines and output


# Tcl, 78 bytes

set i 8
lmap x {c o n e m o n} {set s ""
time {set s $s$x} [incr i 2]
puts $s}  Try it online! # PowerShell, 35 34 bytes 'conemon'|% t*y|%{"$_$_"*(++$j+4)}


Try it online!

-1 byte thanks to mazzy

Literal string 'conemon' is converted toCharArray, then for each character we multiply it out by the appropriate length. This is handled by doubling up the character $_$_ then multiplying by $j+4 with $j pre-incremented each time (i.e., so it'll start at 1+4 = 5, which gets us 10 characters).

Each newly formed string is left on the pipeline, and implicit Write-Output gives us newlines for free.

• -1? 'conemon'|% t*y|%{"$_$_"*(++$j+4)}. It is not reentrant. It requires rv j before second run. Commented Oct 2, 2018 at 13:41 • @mazzy Or save it into a .ps1 script and execute the script. Thanks for the byte! Commented Oct 2, 2018 at 14:50 # MathGolf, 15 bytes ╕│Pùmon+ô8î∞+*p  Try it online! ### Explanation ╕│P Compression of 'cone' ùmon Push 'mon' + Concatenate together ô Foreach over each letter 8 Push 8 î∞ Push the index of the loop (1 based) and double it + Add the 8 *p Repeat the letter that many times and print with a newline  • I'll write an explanation of the string compression in the mathgolf chat, look there in a minute. You could get 2-3 bytes off this solution. – maxb Commented Oct 2, 2018 at 11:43 • This is one byte shorter. – maxb Commented Oct 2, 2018 at 11:51 • The mapping to list of chars should not be needed now, saving one byte – maxb Commented Oct 2, 2018 at 16:06 # Husk, 11 bytes zR↓4İ0¨cΦ◄‰  Try it online! ### Explanation zR↓4İ0¨cΦ◄‰ ¨cΦ◄‰ A = The compressed string "conemon" İ0 B = The infinite list of even positive numbers ↓4 without its first four elements: [10,12,14,16...] zR Create a list of strings replicating each character in A as many times as the corresponding number in B  A list of strings in Husk is printed by joining them with newlines. # K (oK), 29 bytes {i::8;{i+::2;i#x}'x}"conemon"  Try it online! I'm not the biggest fan of this solution as it's bad practice (global variables), but it's short. May work on a better solution. • You'll need to include the "conemon" in your bytecount - take a look at the other K solution for inspiration :) – mkst Commented Oct 4, 2018 at 20:24 • The other K solution is very neat, still coming to grips with this language. Do you know of any resources for k? I work with q, but would like to become more familiar with what's under the hood Commented Oct 8, 2018 at 21:48 • Q is just syntactic sugar on top of K4, and you can see the underlying K commands by typing the Q command raw into the REPL, e.g. count will return #:. There is a good manual for oK available here (an open source implementation of a mix of K5 and K6) which explains a lot of the commands. I would also suggest you taking a look at all the codegolf answers written in K for inspiration. – mkst Commented Oct 9, 2018 at 12:55 • There's also a Q Idioms page which shows how to perform the same task in Q or K – mkst Commented Oct 9, 2018 at 12:56 • Great, thank you for the link <<<Q is just syntactic sugar on top of K4, and you can see the underlying K commands by typing the Q command raw into the REPL>>> That's literally how I've been writing any of these K answers, writing it in q and then just switching to the underlying K if I can because it's so much more terse Thanks for the link Commented Oct 9, 2018 at 12:56 # Red, 53 bytes n: 8 foreach c"conemon"[loop n: n + 2[prin c]print""]  Try it online! # Charcoal, 14 bytes Ｅconemon×ι⁺χ⊗κ  Try it online! Link is to verbose version of code. Explanation:  conemon Literal string Ｅ Map over characters κ Current index ⊗ Doubled χ Predefined variable 10 ⁺ Add ι Current character × Repeat Implicitly print each string on separate lines  # APL (Dyalog Classic), 21 bytes ⎕←↑'conemon'⍴¨⍨8+2×⍳7  Try it online! • I believe you can drop the first 2 bytes Commented Oct 2, 2018 at 12:32 • @Quintec Doesn't print anything in TIO without the first 2 bytes, that's why I left them Commented Oct 2, 2018 at 12:43 • put it in input Commented Oct 2, 2018 at 12:46 • @Quintec - I'm not sure if it's acceptable. Commented Oct 2, 2018 at 13:09 • Actually, for TIO you need to put anything prefixed with ⎕← to display output, or put it in input. For TryAPL and Dyalog application you don't. Commented Oct 3, 2018 at 0:16 # Haskell, 44 bytes i=[0..] g=["conemon"!!n<$take(10+n*2)i|n<-i]


Try it online!

We generate a list of lists of lengths 10, 12 etc. (by taking the appropriate amount of elements from an infinite list) and then replace each element in each such list with corresponding character from the required string.

• ["conemon"!!n<$[0..9+2*n]|n<-[0..]] (without i). As anonymous functions are allowed, you don't have to give the function a name, so drop the g=. However, I'm not sure whether a list of strings is a valid output format for this particular challenge as it says "each [...] string [...] printed on a new line". – nimi Commented Oct 2, 2018 at 14:45 # Canvas, 14 bytes conemon｛²«８＋×］  Try it here! ## F#, 71 bytes let d=Seq.iteri(fun i c->System.String(c,10+i*2)|>printfn"%s")"conemon"  Try it online! Seq.iteri iterates through the sequence and applies the function to the index of the item i and the item itself c. In this case the string, every character in the string conemon. System.String is a shortform of new System.String, taking the current letter c and repeating it 10+i*2 times, where i is the index of the letter. It then prints the string to the output with a new line. You can omit the string and shorten it to: let d=Seq.iteri(fun i c->System.String(c,10+i*2)|>printfn"%s")  And this will work with every string. But given this challenge is specifically for conemon the string is hard-coded. # jq, 56 characters (52 characters code + 4 characters command line options) [[range(5;12)],"conemon"/""]|transpose[]|.[1]*.[0]*2  Sample run: bash-4.4$ jq -nr '[[range(5;12)],"conemon"/""]|transpose[]|.[1]*.[0]*2'
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn


Try it online!

# Ruby, 48 bytes

->{a=4;'conemon'.each_char{|s|puts s*(a=1+a)*2}}


Try it online!

# Pyth, 17 bytes

j.e*b+Tyk"conemon


Try it here

### Explanation

j.e*b+Tyk"conemon
.e      "conemon    For each character 'b' and index 'k' in "conemon"...
*b+Tyk            ... get 2k + 10 copies of b.
j                    Join the result with newlines.


## D, 48 bytes

foreach(i,c;"conemon")c.repeat(10+i*2).writeln;


Explanation:

foreach(i,c;"conemon")                           // Loop over string with index i, char c
c.repeat(10+i*2)           // Repeat character 10 + (i*2) times
.writeln;  // Write with newline


Run with rdmd:

$rdmd --eval='foreach(i,c;"conemon")c.repeat(10+i*2).writeln;' cccccccccc oooooooooooo nnnnnnnnnnnnnn eeeeeeeeeeeeeeee mmmmmmmmmmmmmmmmmm oooooooooooooooooooo nnnnnnnnnnnnnnnnnnnnnn  # T-SQL, 84 bytes DECLARE @ INT=1a:PRINT REPLICATE(SUBSTRING('conemon',@,1),2*@+8)SET @+=1IF @<8GOTO a  The variable/loop approach turned out shorter than the best set-based variation I came up with (91 bytes): SELECT REPLICATE(SUBSTRING('conemon',n,1),2*n+8)FROM(VALUES(1),(2),(3),(4),(5),(6),(7))a(n)  I don't know what it is, but I found this question particularly annoying. Which probably means it's a good question. # MBASIC, 80 73 bytes 1 S$="conemon":FOR I=1 TO LEN(S$):PRINT STRING$(8+I*2,MID$(S$,I,1)):NEXT


Saved a loop by using the STRING$function to generate the string of characters. Saved another 7 bytes by computing the length relative to the loop index. Output: cccccccccc oooooooooooo nnnnnnnnnnnnnn eeeeeeeeeeeeeeee mmmmmmmmmmmmmmmmmm oooooooooooooooooooo nnnnnnnnnnnnnnnnnnnnnn  # V, 27 26 bytes Iµc ¶o ·n ¸e ¹m ±o ±±n<esc>Îä$


<esc> represents the escape character (ascii 27)

Try it online!

## Explanation

I                Enter insert mode
µc                Write 5 c and a newline
¶o                Write 6 o and a newline
·n                Write 7 n and a newline
¸e                Write 8 e and a newline
¹m                Write 9 m and a newline
±o                Write 10 o and a newline
±±n               Write 11 n
<esc>            End insert mode
Îä\$              Duplicate every line


# Jelly,  14  13 bytes

-1 Thanks to Erik the Outgolfer (pointing me to the real optimal string compressor)
...and, of course, to user202729 (for creating it)!

“¦[Þ⁷ƥ»J+4×ḤY


A full program which prints the output required.

Try it online!

### How?

“¦[Þ⁷ƥ»J+4×ḤY - Main Link: no arguments
“¦[Þ⁷ƥ»       - compressed string as a list of characters -> ['c','o','n','e','m','o','n']
- (...due to this being a leading constant this is now the argument too)
J      - range of length  -> [ 1, 2, 3, 4, 5, 6, 7]
4    - literal four
+     - add (vectorises) -> [ 5, 6, 7, 8, 9,10,11]
×   - multiply by the argument -> ['ccccc','oooooo',...,'nnnnnnnnnnn']
Ḥ  - multiply by 2 (vectorises) -> ['cccccccccc','oooooooooooo',...,'nnnnnnnnnnnnnnnnnnnnnn']
Y - join with newline characters
- implicit print

• I guess there's no literal for 11 in Jelly?
– Jo King
Commented Oct 2, 2018 at 11:08
• There is 11 :) Commented Oct 2, 2018 at 11:10
• ¢nṣkœ+¦s⁾ıß. Yes, mon is a word. Commented Oct 2, 2018 at 15:36

# J, 25 24 bytes

 echo'conemon'#"0~2*5+i.7


Try it online!

Note: There are trailing spaces on all lines except the last one.

# C# (Visual C# Interactive Compiler)65 64 bytes

for(int i=0;i<7;){WriteLine(new string("conemon"[i],i++*2+10));}


thanks to @Jonathan Frech saving 1 byte

new string(char, int) repeats the char as often as the int value.

C#, 72 bytes without "Console" as static using (example outside interactive compiler):

for(int i=0;i<7;){Console.WriteLine(new string("conemon"[i],i++*2+10));}

• I think you can move your i++ into your i*2+10. Commented Oct 2, 2018 at 16:22

# Pyth, 17 16 bytes

V"conemon"*N~+T2


Try it online here.

V"conemon"*N~+T2   Implicit: T=10
V"conemon"         For each character in "conemon", as N:
*N  T      Repeat N T times, implicit print with newline
~+T2     T += 2


# SOGL V0.12, 13 bytes

╝⌠Ei№‘{ē«L+*P


Try it Here!

Explanation:

╝⌠Ei№‘       push "conemon" - 2 words "cone" and "mon" compressed
{      for each
ē       push the value of e (default 0), and increment it (aka e++)
«      multiply that by 2