# Introduction

The childhood song Eeny, meeny, miny, moe was often used to select who was "it" when playing tag. Everyone would stand in a circle and point at one person selected at random. They would sing:

Eeny, meeny, miny, moe,
Catch a tiger by the toe.
If he hollers, let him go,
Eeny, meeny, miny, moe.

As they sung each word, they pointed at the next person in the circle. The person being pointed to when the final "moe" was sung would be "it". The children would immediately stand up and scatter.

# Goal

Implement the shortest program in bytes that takes an input, the number of children, and lists the words that were sung when they were being pointed at.

The winner will be selected in one week.

# Input

From STDIN, a single, positive integer, the number of children. This may be more than the number of words in the song.

# Output

Writes to STDOUT a list where each line represents a child and contains the word sung while they were being pointed at. If there are too many children, empty lines may be omitted.

# Requirements

• Display the words without punctuation.
• The final "moe" should be emphasised as "MOE!" including punctuation.

# Example

## Input

3


## Output

Eeny moe tiger toe hollers go miny
meeny Catch by If let Eeny MOE!
miny a the he him meeny


## Input

7


## Output

Eeny by him
meeny the go
miny toe Eeny
moe If meeny
Catch he miny
a hollers MOE!
tiger let


## Input

1


## Output

Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!


## Input

21


## Output

Eeny
meeny
miny
moe
Catch
a
tiger
by
the
toe
If
he
hollers
let
him
go
Eeny
meeny
miny
MOE!

• Will the input ever be greater than the number of words present? – Doorknob Jan 20 '16 at 0:18
• Should "catch a" and "if he" and "by his"/"by the" be treated as two words or one? In the song, they only count as one "point" – OldBunny2800 Jan 20 '16 at 2:38
• We always ended with "My...mother...said...to...pick...the...very...best...one...and...you...are...IT!" That would be a cool bonus. Of course, the cheaters always dragged out the "you" and the "are" over several people... – ThisSuitIsBlackNot Jan 20 '16 at 21:52
• @ThisSuitIsBlackNot NOOO (Darth Vader voice)! You stole my line. I literally logged on to PPCG just to write that since I've been thinking about it for the past two days since I saw this. – Ashwin Gupta Jan 22 '16 at 3:26
• Not so fun fact: Tiger used to be the N word. – DanTheMan Jan 24 '16 at 15:11

# TeaScript, 82 bytes

D${a="Ey Ú9y ·ny "}¶e C® a g by e e If Ò@s ¤t m go${a}MOE!q.KαtΣj═)j╝


Decompress, chunk, transpose, join, output.

## Explanation

              // Implicit: x = input
D...blah... // Decompress "Eeny miny moe..."
q             // Split
Kα            // chunk into x-size blocks (α == x)
t             // Transpose
Σ             // Loop through lines
j═)             // Join with spaces
j╝            // Join with newline


Non-competing 81 byte

The α wasn't getting chained . so I had to bug fix this

D${a="Ey Ú9y ·ny "}¶e C® a g by e e If Ò@s ¤t m go${a}MOE!qKαtΣj═)j╝


# Pyth, 10389 84 chars

Saved 18 bytes with string compression, thanks to @Dennis and @FryAmTheEggman
Saved another byte thanks to @isaacg

Warning: there are many unprintables in the code; use the links below to try it.

VQjd%Q>cs[J."@y)òÎ5O¹c×Ú"."@yæ\J}ÇZH66¥ÓÀD¸¶=ðÉ §J%ÔþÖúÅ="J"MOE!")\@N


Could probably be golfed. Suggestions welcome!

### How it works

VQjd%Q>cs[J."..."."..."J"MOE!")\@N    Implicit: Q = eval(input)
VQ                                    For each item N in range 0...int(Q):
[                    )        Create an array out of the following:
J."..."                       Set J to this string, decompressed. ("Eeny@meeny@miny@")
."..."                 This string, decompressed. ("moe@Catch@...let@him@go@")
J                J.
"MOE!"          "MOE!".
s                              Join the array with the empty string.
c                       \@      Split the result on "@".
>                          N     Cut off the first N items.
%Q                                 Take every Qth item.
jd                                   Join with spaces.

• Reusing Eeny meeny miny somehow should save a few bytes. Also, Pyth has two built-ins for (de)compression (.Z and ."). – Dennis Jan 20 '16 at 1:30
• @Dennis Thanks, ." saves 14 bytes! – ETHproductions Jan 20 '16 at 1:34
• Does Pyth use UTF-8 or something else? This is 89 chars but 123 bytes – Downgoat Jan 20 '16 at 2:19
• @Doᴡɴɢᴏᴀᴛ Pyth uses ISO 8859-1 by default, so each character is exactly one byte. – Dennis Jan 20 '16 at 2:22
• FNQ == VQ, by the way. – isaacg Jan 20 '16 at 4:50

# Jelly, 84 bytes

“£Dṡ“Ṙ©“Ė“¡Ḳ⁵“=U“¡Ẹ⁵“¡Ṇm“ȯf“ŀQ“ÞṖċ¥“ṅ_“Ẉ1“¡æḷ“¡ƒmxĠ“¡ṇƭEỤr“¡Þ¦»ṫ-2;;“MOE!”W¤sƓZj€⁶j⁷


Try it online!

• Compressing the string by hand was... entertaining. The score would be a lot better if Jelly had a split at occurrences function. – Dennis Jan 20 '16 at 1:20

# JavaScript (ES6), 167 bytes

l=Array(n=+prompt()).fill;${s=Eeny meeny miny }moe Catch a tiger by the toe If he hollers let him go${s}MOE!.split .map((w,i)=>l[i%n]+=w+ );alert(l.join
)

## Explanation

l=Array(              // l = array of lines
n=+prompt()         // n = input number
).fill;             // initialise l as empty strings

${s=Eeny meeny miny }moe Catch a tiger by the toe If he hollers let him go${s}MOE!

.split .map((w,i)=> // for each word w
l[i%n]+=w+        // add it to the lines
);
alert(l.join
)                    // output the lines

• Does l=Array(n).fill  not work for some reason? – ETHproductions Jan 20 '16 at 1:43
• @ETHproductions It works. I just forgot to shorten it somehow haha! Thanks. – user81655 Jan 20 '16 at 1:56
• @user81655 I love JS prompt() windows. They are just so fun. (I know that sounds crazy but I mean in comparison to every other language's console.out or equivalent print type expression) – Ashwin Gupta Jan 20 '16 at 5:08

import Data.Lists
unlines.map unwords.transpose.(chunksOf(["moe Catch a tiger by the toe If he hollers let him go","MOE!"]>>=words.("Eeny meeny miny "++)))


Prepend "Eeny meeny miny " to the other parts ("moe Catch ..." and "MOE!"), concatenate both strings, split into words, take chunks of required size, transpose and concatenate again into a single string.

@Mauris found 3 bytes by factoring out the common substring "Eeny meeny miny " and making f pointfree.

• Maybe s="Eeny meeny miny " saves some bytes. – Lynn Jan 20 '16 at 1:02
• @Mauris: I tried, but it was longer. – nimi Jan 20 '16 at 1:05
• @Mauris: ... oh no, it has the same length. – nimi Jan 20 '16 at 1:07
• How about f=unlines.map unwords.transpose.(chunksOf(["moe Catch a tiger by the toe If he hollers let him go","MOE!"]>>=words.("Eeny meeny miny "++))) – Lynn Jan 20 '16 at 16:01
• @Mauris: Nice. Once f is completely pointfree we can omit even the name. – nimi Jan 20 '16 at 19:25

## Ruby, 160 bytes

puts (a=[*%w[Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!].each_slice(gets.to_i)])[0].zip(*a[1..-1]).map{|x|x*' '}


All my attempts at "compressing" the string have just made it longer. Still trying...

puts                      # output to STDOUT...
(a=                       # assign this stuff to the variable a
[*                       # convert to array...
%w[blah blah]           # %w splits on spaces
.each_slice(gets.to_i)  # split into slices of input number
]
)[0]                      # take the first element of a
.zip(*a[1..-1])           # zip it with the remaining elements
#   because transpose complains about ragged 2D arrays
.map{|x|x*' '}            # join all sub-arrays on space
#   puts automatically inserts newlines for us


# Python 2, 154 147 bytes

EDIT: Thanks Joe Willis!

i=input()
s='Eeny meeny miny '
for j in range(i):print' '.join((s+'moe Catch a tiger by the toe If he hollers let him go '+s+'MOE!').split()[j::i])


This uses the trick that [0::n] prints the nth element of the list.

Try it here

• Ouch. Well you just totally destroyed my answer. LOL. I'm going to try your tip later today about the print("\n"). What exactly does :: operator do? Is that like for in loop? – Ashwin Gupta Jan 20 '16 at 14:53

# JavaScript (ES6), 189 bytes:

a=prompt(),b=Array(a--).fill,c=0;"Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!".split .map(v=>(b[c]+=v+' ',c+=c>a-1?-c:1));alert(b.join\n)


# Explanation:

a=prompt(), //Get the STDIN
b=Array(a--).fill, //Make an array based on how many kids there are
c=0; //Start the iteration variable
"Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!"
.split .map(
v=>(
b[c] += v + ' ',
c += c > a - 1 ? -c : 1
)
);alert(b.join\n)

• Your input method is correct, but the output method is not accepted. You can, however, wrap it all in a function, receiving the input as an argument. You can try the following: I=>(b=Array(I--).fill,c=0,"Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!".split .forEach(v=>(b[c]+=v+' ',c+=c>I-1?-c:1)),b), which is 172 bytes long. It returns each line as an element in the array. I think this is acceptable. – Ismael Miguel Jan 20 '16 at 16:00
• By the way, if you use .map() instead of .forEach(), you can save 3 bytes, reducing to 169 bytes. With a bit more of fiddling, this might actually be tweetable! – Ismael Miguel Jan 20 '16 at 16:24
• @IsmaelMiguel The question asks for input and output to be specifically through STDIN and STDOUT so I think it limits JavaScript answers to prompt and alert unfortunately. – user81655 Jan 21 '16 at 0:26
• Oh, I see. I will update the code when I get a chance. Thanks for informing me :-) – Quill Jan 21 '16 at 0:32
• @user81655 You are correct. It should have an alert(b.join<newline>) at the end. But the damage can still be reduced with .map(), instead of .forEach(). – Ismael Miguel Jan 21 '16 at 9:58

## Python 3, 279278272 173 bytes

(thanks to Mathias Ettinger who literally saved me 100+ BYTES!)

s=" Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny moe!";w=s.split();i=input();i=int(i)
for z in range(i):W=w[z::i];print(" ".join(W))


If anyone has tips or sugestions I'd really appreciate them. Thanks!

• I think you've misunderstood what the input represents. It's not the line number to show, it's the number of children among which to divide the words. Every line should be displayed. In your code, int(i) should take the place of 3, but there are other errors to fix after that. – Hand-E-Food Jan 20 '16 at 3:44
• @Hand-E-Food okay I believe it works as you specified now! – Ashwin Gupta Jan 20 '16 at 4:02
• That looks better! :-) And if you want some golfing help, investigate the Modulo operator, usually written as %. It's ideal for cyclic counters. – Hand-E-Food Jan 20 '16 at 5:04
• @Hand-E-Food ok thanks! I think I know what you are getting at. I am going to fix this up tomorrow. I think I can shave at least a couple bytes off. – Ashwin Gupta Jan 20 '16 at 5:06
• A few points that serves both at best practices and help shorten the code: 1) .split() will split on blanks (space, newlines, tabs) 2) range(0, x) is best written as range(x) 3) have a look at slice notation: w[0::3] will return a list of every three words in w. – 301_Moved_Permanently Jan 20 '16 at 13:47

# Mathematica, 154 bytes

StringRiffle[Thread@Partition[StringSplit@"Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!",#,#,1,""],"
"," "]&


Uses the split-chunk-transpose-join-output method of most of the other answers.

# MATLAB, 167 bytes/characters:

n=input('');s='Eeny meeny miny ';s=strsplit([s 'moe Catch a tiger by the toe If he hollers let him go ' s 'MOE!']);f=@fprintf;for i=1:n f('%s ',s{i:n:end});f('\n');end


# Explanation:

n=input('');             % Grab the input (number of children)
s='Eeny meeny miny ';    % Common string portion
% Build the full string and split into cell array at spaces
s=strsplit([s 'moe Catch a tiger by the toe If he hollers let him go ' s 'MOE!']);
f=@fprintf;              % Just a shorthand for later (only saves 1 char here)
for i=1:n                % Loop to the number of children
f('%s ',s{i:n:end}); % Print each nth word, shifted by child
f('\n');             % Start each child's words on a new line
end


Won't be winning any awards for the length of this one, but it was fun. :-)

# Japt, 9087 86 bytes

Uo mW{V=EydÚ9yd·nyd +¶C®»dgdbydÈIfddÒ@sd¤tdmdgod{V}MOE! qd f@Y%U¥W} m¸·


Lots of unprintables. Try it online!

### How it works

              // Implicit: U = input
Uo mW{     }  // Create the range 0...U and map each item W to:
V=...       //  Set V to this string, decompressed. "Eenydmeenydmined"
+...{V}MOE! //  Concatenate it with this string, decompressed, with V inserted.
qd            //  Split at "d"s.
f@Y%U¥W       //  Filter to only the items where (index % U == W).
m¸            // Map each item by joining with spaces.
·             // Join the result with newlines.


I've tried compressing the string with different delimiters. The only thing more efficient than spaces would be a lowercase letter, but most of these are already used, and thus, can't be used to split the string. Here's how much compression is achieved with the remaining ones:

space -> 69 bytes
c -> 66 (including a null byte)
d -> 65
j -> 69
k -> 69
p -> 68
q -> 69
s -> 61 (but there's an s in "hollers")
u -> 65
w -> 67
x -> 69
y -> 69


Currently I'm using d. It may be possible to save a byte with s, substituting some other letter in hollers.