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 '20 at 10:43
  • 6
    \$\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 '20 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 '20 at 21:58
  • 1
    \$\begingroup\$ @user253751 It's Slovene actually, but that's close enough :) \$\endgroup\$ – jgosar Dec 17 '20 at 6:21
  • 2
    \$\begingroup\$ I happened to find a video for this song. \$\endgroup\$ – PIG208 Dec 17 '20 at 9:24

15 Answers 15


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\$ – Kevin Cruijssen Dec 16 '20 at 9:21
  • 1
    \$\begingroup\$ Or better: change it to = instead, and then »¨ to ? for -2: 52 bytes \$\endgroup\$ – Kevin Cruijssen Dec 16 '20 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 '20 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 '20 at 22:57
  • 1
    \$\begingroup\$ haha "Don't try it online" \$\endgroup\$ – Greg Martin Dec 17 '20 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 '20 at 12:39
  • 1
    \$\begingroup\$ Credit to @Arnauld: you can save another byte by changing to /[aeiu]/. \$\endgroup\$ – Dingus Dec 16 '20 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 '20 at 13:30

Wolfram Language (Mathematica), 146 134 bytes

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


Try it online!


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!


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 '20 at 9:41
  • \$\begingroup\$ Thanks @axiac, fixed it. \$\endgroup\$ – jgosar Dec 16 '20 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 '20 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 '20 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!


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.


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).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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