in my country we have a children's song which goes like this:

Priletela muha na zid, muha na zid, muha na zid.
Priletela muha na zid,
muha na zid.

Pralatala maha na zad, maha na zad, maha na zad.
Pralatala maha na zad,
maha na zad.

Preletele mehe ne zed, mehe ne zed, mehe ne zed.
Preletele mehe ne zed,
mehe ne zed.

Prilitili mihi ni zid, mihi ni zid, mihi ni zid.
Prilitili mihi ni zid,
mihi ni zid.

Prolotolo moho no zod, moho no zod, moho no zod.
Prolotolo moho no zod,
moho no zod.

Prulutulu muhu nu zud, muhu nu zud, muhu nu zud.
Prulutulu muhu nu zud,
muhu nu zud.

As you can see, it contains a bit of redundant information. So I was wondering if it could be compressed a bit.

This is code golf — shortest code wins.

  • 1
    \$\begingroup\$ List of similar challenges \$\endgroup\$
    – Luis Mendo
    Dec 16, 2020 at 10:43
  • 7
    \$\begingroup\$ To save curious people the effort: Google Translate detects it as Croatian and says: "A fly landed on the wall, a fly on the wall, a fly on the wall." and obviously the remaining verses are nonsense. Google didn't find a dictionary containing "priletela" so I don't know for sure. Wiktionary has a similar word in Russian and Google finds it in a Slovenian song. \$\endgroup\$
    – user253751
    Dec 16, 2020 at 18:20
  • 3
    \$\begingroup\$ @user253751 the translation is correct. The first verse is understandable for anyone speaking some slavic language and is more or less valid at least in Serbian, Croatian, Macedonian and some Bulgarian dialects. Zid is masonry, but can mean wall as well. \$\endgroup\$
    – fraxinus
    Dec 16, 2020 at 21:58
  • 1
    \$\begingroup\$ @user253751 It's Slovene actually, but that's close enough :) \$\endgroup\$
    – jgosar
    Dec 17, 2020 at 6:21
  • 3
    \$\begingroup\$ I happened to find a video for this song. \$\endgroup\$
    – PIG208
    Dec 17, 2020 at 9:24

23 Answers 23


05AB1E, 54 52 bytes

Thanks to Kevin Cruijssen for -2 bytes!

T"ÿ, 0, 0.

Try it online!


T                         # push 10
 "ÿ, 0, 0.\nÿ,\n0.\n"     # push string literal "10, 0, 0.\n10,\n0.\n"
  T                       # push 10 again
   .•ý‹¨ΣªßˆTδ}vØ#•       # push compressed string "priletela xmuha na zid"
    .ª                    # sentence case => "Priletela xmuha na zid"
      ‛x¡                 # split on 'x'  => ["Priletela ", "muha na zid"]
         ‡                # replace every digit of 10 with the corresponding list entry in the string literal
                          # this is the first verse
          žM              # push the vowels "aeiou"
            v      }      # for y in vowels:
             =            #   print the last verse without removing it from the stack
              žM          #   push the vowels
                yÞ        #   the infinite list of the vowel y
                  ‡       #   replace every vowel with y
                    ?     # print the last verse without a trailing newline

more obfuscated and a lot slower 52-byter:

•nöðrb•ØTz… ,

Don’t try it online!

•nöðrb•              # push compressed integer 211262272027
       Ø             # push the 211262272028th prime 5996494318979 (slow)
        Tz           # push 1/10
          … ,\n      # push string " ,\n"
               «     # concatenate to "0.1 ,\n"
                Åв   # convert the prime into that custom base
                  J  # join from list of chars into a string
                     # this generates the same string as T"ÿ, 0, 0.\nÿ,\n0.\n" above
  • 1
    \$\begingroup\$ You can remove © and change ® to D for -1. \$\endgroup\$ Dec 16, 2020 at 9:21
  • 1
    \$\begingroup\$ Or better: change it to = instead, and then Ȭ to ? for -2: 52 bytes \$\endgroup\$ Dec 16, 2020 at 9:23
  • \$\begingroup\$ @KevinCruijssen thanks a lot. I actually used manual printing before, but didn't think about printing in the next iteration. \$\endgroup\$
    – ovs
    Dec 16, 2020 at 9:34
  • 1
    \$\begingroup\$ @GregMartin thanks a lot, I just asked WolframAlpha and concluded from the result that it would be too much effort to compute the number, but I guess I was wrong :). The goal of the second program is to generate the verse layout string in the most convoluted way at the same byte count, and this adds another step to it ;) \$\endgroup\$
    – ovs
    Dec 16, 2020 at 22:57
  • 1
    \$\begingroup\$ haha "Don't try it online" \$\endgroup\$ Dec 17, 2020 at 0:04

Ruby 2.7, 110 105 104 bytes

Saved five bytes, thanks to Dingus!
Saved a byte using Arnauld's finding.

puts z="#{y="Priletela #{$x='muha na zid'},"} #$x, #$x.
#$x.","aeiou".chars.map{z.gsub /[aeiu]/,_1}

Try it online!

TIO uses an older version of Ruby, whereas in Ruby 2.7, we've numbered parameters, which saves two bytes.

  • \$\begingroup\$ @Dingus - Oh thanks! I didn't checked the rules of this challenge.. \$\endgroup\$
    – vrintle
    Dec 16, 2020 at 12:39
  • 1
    \$\begingroup\$ Credit to @Arnauld: you can save another byte by changing to /[aeiu]/. \$\endgroup\$
    – Dingus
    Dec 16, 2020 at 12:51

JavaScript (ES6),  121  120 bytes

_=>["$&",..."aeiou"].map(v=>`${p=`Priletela ${q='muha na zid'},`} ${q}, ${q}.


Try it online!


_ =>                            // anonymous function ignoring its input
 [                              //
    "$&",                       // 1st stanza: use "$&" to leave the vowels unchanged
    ..."aeiou"                  // next ones: force all vowels to "a", "e", ..., "u"
  ]                             //
  .map(v =>                     // for each replacement pattern v:
    `${                         //   build the stanza template
      p = `Priletela ${         //     by defining p = "Priletela muha na zid,"
        q = 'muha na zid'       //     and q = "muha na zid"
      },`                       //
    } ${q}, ${q}.\n${p}\n${q}.` //     and using them to build the other parts
    .replace(                   //   update the template:
      /[aeiu]/g,                //     replace each vowel ...
      v                         //     ... with the replacement pattern
                                //     NB: there's no "o" in the template
    )                           //   end of replace()
  ).join`\n\n`                  // join with two line-feeds
  • \$\begingroup\$ +1, Nice find that there is no o ;-) \$\endgroup\$
    – vrintle
    Dec 16, 2020 at 13:30

Python 2, 122 bytes

s="Priletela muha na zid,"
for x in v:
 w=s[10:-1]+".\n";print s,s[10:],w+s+"\n"+w
 for y in v:s=s.replace(y,x)

Try it online!


Wolfram Language (Mathematica), 146 134 bytes

w="muha na zid";a="Priletela ";s=""<>{a,w,", ",w,", ",w,".


Try it online!


Bash + sed, 98 bytes

sed -ney/{%/\\n,eiu/aaa,a/e,e/i,i/o,o/u}/\;p<<<"${x=Priletela ${y=muha na zid}}, $y, $y.%$x,%$y.%"

Try it online!


Jelly, 62 bytes

3,2µ“muha na zid”Wẋjị⁾ ¶ṭ”,Ɗ⁶;“!b^ṙzḳ“)»j)Y

Try it online!


3,2µ“muha na zid”Wẋjị⁾ ¶ṭ”,Ɗ⁶;“!b^ṙzḳ“)»j)Y   Auxiliary niladic link
3,2                                           [3, 2]
   µ                                     )    For each:
    “muha na zid”W                              ["muha na zid"]
                  ẋ                             Repeat that many times
                   j       Ɗ                    Join with:
                    ị⁾ ¶                          Index with the number into " \n"
                        ṭ”,                       Append that to ","
                            ⁶;                  Prepend a space
                              “!b^ṙzḳ“)»j       Join ["Priletela", "."] with this
                                          Y   Join with a newline

ØẹµØẹW;y¢)¢W¤;j⁾¶¶   Main niladic link
Øẹ                   "aeiou"
  µ      )           For each:
   ØẹW                 ["aeiou"]
      ;                Append the vowel
       y¢              Translate the result of the previous link with this table
          ¢W¤;       Prepend list with result of previous link
              j⁾¶¶   Join with double newlines

Red, 150 bytes

e: rejoin[a:"Priletela "b:"muha na zid"c:", "b c b d:".^/"a b c"^/"b d]v:
charset w:"aeiou"foreach u w[print e parse e[any[change v u | skip]]]print e

Try it online!


For a start, this is my attempt in Javascript:

JavaScript (Node.js), 184 bytes

x='muha na zid'
z=`${y} ${x}, ${x}, ${x}.\n${y} ${x},\n${x}.`
console.log([z].concat(a.split('').map(e=>z.replace(new RegExp('['+a+']', "g"), e))).join('\n\n'))

Try it online!

  • \$\begingroup\$ It needs a semicolon or a new line before console.log(). It does not compile as it is now. \$\endgroup\$
    – axiac
    Dec 16, 2020 at 9:41
  • \$\begingroup\$ Thanks @axiac, fixed it. \$\endgroup\$
    – jgosar
    Dec 16, 2020 at 9:47
  • \$\begingroup\$ You can save a lot of bytes by using /[aeiou]/g instead of new RegExp('['+a+']', "g"). \$\endgroup\$
    – axiac
    Dec 16, 2020 at 10:07
  • \$\begingroup\$ You can save 2+2 more bytes by squeezing the assignment of x and y into their first usage, like this: z=`${y='Priletela'} ${x='muha na zid'}, ${x}, ${x}.\n${y} ${x},\n${x}.` . \$\endgroup\$
    – axiac
    Dec 16, 2020 at 10:38

Jelly, 58 bytes

I feel like ”u”aØẹe?ṙ1Øẹ,y could be golfed


Try it online!


Perl 5 (-0777p), 91 bytes

s//Priletela muha na zid/;/ /;$_.=", $', $'.

Try it online!


05AB1E, 84 bytes


Try it online!


C (gcc), 154 152 146 bytes

I wrote nonprintables that won't show up on SE in hex using <kbd>.

i,p[]=L"muha na zid0x00Priletela ";main(){for(;i<48;p["0x140x120x100x0e0x090x060x030x01"[i%8]]="aeiou"[i++/8])i%8?:printf("%S%S, %2$S, %2$S.\n%1$S%2$S,\n%2$S.\n\n",p+12,p);}

Try it online!

#include <stdio.h>

int main(void)
    // These are merged together with a raw null byte in the golfed code.
    // I set them to wchar_t (L"") solely because of implicit int, cuz screw
    // Windows and its UTF-16. :P
    char pril[] = "Priletela"; // golfed code has trailing space
    char muha[] = "muha na zid";
    // The golfed code does a different loop pattern where it does one big
    // loop which replaces a char each iteration and prints when i%8==0.
    // However, that is difficult to follow.
    for (int i = 0; i < 6; i++) {
        // Note: golfed code doesn't use positionals on the first two arguments,
        // and it uses %S because they are wchar_t strings.
        // Priletela muha na zid, muha na zid, muha na zid.
        // %1$s      %2$s       , %2$s       , %2$s       .\n
        // Priletela muha na zid,
        // %1$s      %2$s       ,\n
        // muha na zid.
        // %2$s       .\n\n
        printf("%1$s %2$s, %2$s, %2$s.\n%1$s %2$s,\n%2$s\n\n", pril, muha);

        // Replace the vowels one by one.
        // The golfed version loops 8 times since it is one string.
        for (int j = 0; j < 4; j++) {
            // Nope, never y.
            const char vowels[] = "aeiou";
            // Vowel indexes. This is encoded in a binary string in the golfed
            // code, and it is one array because the strings are merged.
            const int pril_lut[] = { 2, 4, 6, 8 };
            const int muha_lut[] = { 1, 3, 6, 9 };
            pril[pril_lut[j]] = vowels[i];
            muha[muha_lut[j]] = vowels[i];

Unless we find a way to kill the printf string, I don't see any other options to make this smaller. I have clearly been proven wrong more than once. :P

-2 bytes thanks to ceilingcat for better variable declaration and looping backwards.

-6 bytes thanks to gastropner for making me eat my words combining the two for loops.

  • 1
    \$\begingroup\$ 146 bytes \$\endgroup\$
    – gastropner
    Jan 29, 2021 at 0:52
  • \$\begingroup\$ Wow, you deserve a medal. I didn't even think of that! \$\endgroup\$
    – EasyasPi
    Jan 29, 2021 at 1:02

Vim, 95 bytes

iPriletela<esc>3a muha na zid,<esc>r.Ypo<esc>k7f r
k4f Dk4YGoaeiou<esc>:s/./&<C-r>0/g

Try it online!

This approach leaves two blank lines at the end of the song. If that's not acceptable, add Vkd to the end for +3 bytes: Try it online!


iPriletela<esc>3a muha na zid,<esc>r.

Insert Priletela; then append three copies of muha na zid, and replace the last comma with a period.


Duplicate the line and insert a blank line below the second copy.

k7f r<cr>k4f D

Replace the seventh space on the second line with a newline. Go back up to the second line and delete from the fourth space to the end of the line. We now have the first verse of the song.


Go up to the first line and yank all four lines. Then insert aeiou after the last line.


Replace each letter of aeiou with itself followed by the yanked lyrics.


Go to line 5 (the start of the second verse) and begin recording into macro r.


Delete the first character, which is the a prepended to the verse.


Within this line and the next two (i.e. this verse), replace any of aeiu with the character we just deleted.


Go down two lines to the start of the next verse. Stop recording the macro.


Run the macro four more times, converting the four remaining verses.


PHP 8, 170 166 bytes

This is the JavaScript solution of @jgosar rewritten in PHP and improved.

$a='aeiou';$x='muha na zid';$y="Priletela $x,";echo implode("

",array_merge([$z="$y $x, $x.

The code is not wrapped on multiple lines for readability but because this way a real newline character embedded in a string uses only one byte vs. two bytes used by the escape sequence \n.

Try it online!


Retina, 70 bytes

Pm, m, m.¶Pm,¶m.¶
muha na zid

Try it online! Explanation:

Pm, m, m.¶Pm,¶m.¶

Insert placeholders for the first verse.

muha na zid

Expand the placeholders.


Compose and execute a Retina script.


Create a list of transliteration targets.


Expand each target into a transliteration command that transliterates vowels into the given target and outputs the verse after the transliteration. The resulting script is as follows:


Here the v represents the vowels aeiou. The o on its own usually means "insert the other set", however this has no effect on the transliteration as the vowels are already present. The exception is the T`vo`o command, where the presence of o on both sides causes it to be treated as a literal, although this does not affect the expansion either.


Lua, 150 bytes

Just because Lua doesn't get enough love.

a='aeiou'for i=0,5 do print((('pm, m, m.\npm,\nm.\n'):gsub('p','Priletela '):gsub('m','muha 
na zid'):gsub('['..(i>0 and a or'_')..']',a:sub(i,i))))end

:gsub():gsub():gsub() :-)

  • \$\begingroup\$ "Lua doesn't get enough love" I see what you did there, if it was on purpose :) \$\endgroup\$
    – xigoi
    Jan 28, 2021 at 12:51
  • \$\begingroup\$ @xigoi : Indeed :) \$\endgroup\$
    – Riptide
    Jan 28, 2021 at 21:11

Java (JDK), 161 bytes

v->{for(var s:"$0,a,e,i,o,u".split(","))System.out.print(s.format("%s%s, %2$s, %2$s.%n%1$s%2$s,%n%2$s.%n%n","Priletela ","muha na zid").replaceAll("[aeiu]",s));}

Try it online!



PHP 7.4, 164 bytes

This is the same as my solution for PHP 8 but it does not surround the value of $a (aeiou) in apostrophes or quotes and saves 2 bytes. This exploits the fact that before PHP 8, the undefined constants were reported as warning and converted to strings. This behaviour changed in PHP 8, they are now reported as errors and the code does not work any more.

$a=aeiou;$x='muha na zid';$y="Priletela $x,";echo implode("

",array_merge([$z="$y $x, $x.

In order to hide the warnings, the option -d error_reporting=0 needs to be added to the command line (or set in php.ini).


Pyth, 76 bytes

Ac." zMzÊ(ºZ¾þXGÈ-gÚe¿P"\qJ", "K+\.b

Try it online!

Python 3.8 translation:

import re
b = "\n"

[G, H] = "Priletela qmuha na zid".split("q")
J = ", "
K = "." + b
print(G := "".join([G,H,J,H,J,H,K,G,H,",",b,H,K]))
for N in (d := "aeiou"):
    print(re.sub("[" + d + "]", N, G))

Python 3.8 (pre-release), 138 bytes

s="Priletela muha na zid, "
print(n.join([[s+s[10:]+(w:=s[10:-2]+n)+s+n+w,[s:=s.replace(y,x)for y in v]][0]for x in v]))

Try it online!

Modified version of answer by xnor using list comprehension. It is not shorter, but it has fewer lines, so I thought I'd post it.


Vyxal j, 68 bytes

1→a`10, 0, 0.
«ƛ&…-∪⋎5wµ\Ė⌊ɾ≤«¡\x€Ŀ£¥kV⇩(←a›→a ¥nkV⇩←a iV)W

Try it Online!


JavaScript, 137 bytes

o="";for(v of ["$&",..."aeiou"])for(c of`12, 2, 2.

`)o+=+c?[,"Priletela ","muha na zid"][c].replace(/[aeiu]/g,v):c;console.log(o)

Try it Online!


o="";                              // Define o
  for(v of ["$&",..."aeiou"])      // Repeat for each vowel + $& 
                                      being the RegExp returned value.
    for(c of`12, 2, 2.             // Numeric values will be replaced later on
      o+=                          // Add at the end of o...
        +c?                        // ...if c is numeric (NaN being falsey):
          [,"Priletela ",          // replace it by the index of the array...
          "muha na zid"][c]
            .replace(/[aeiu]/g,v)  // ...and replace every vowel by the current 
                                      vovel (or $& which doesn't affect it)
              :c;                  // otherwise, add c
                console.log(o)     // Finally, output o

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.