Repeat a rhyme and loop on the vowels

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
15
down vote

favorite
2












Vowels rhyme: Apples and Bananas



There is a traditional children's song that repeats the same text over and over, only each time every vowel is replaced with a random vowel, but constant across the current stanza.



Challenge



The objective is to propose the shortest code that performs such a transformation on an input text.



Rules



  1. You must print the rhyme as many times as there are distinct vowels in it.

  2. Each print must be separated with a line break (platform-specific combo of n and r is accepted).

  3. For iteration i, replace each vowel with the ith distinct vowel in the original text.

  4. The input text is a sequence of printable ASCII characters (range [32, 126].

  5. Input will not contain embedded line breaks.

  6. Only vowels characters must be affected, other must be output exactly as input.

  7. Only vowels characters count: nasal vowels, although sounding like vowels (like in French "Tintin"), must not be handled as a single vowel.

  8. Case matters for the output, but is positional (replacing an uppercase vowel is done with the uppercase replacement vowel)

  9. Uppercase vowels are not distinct from their lowercase counterpart (ie a <=> A)

  10. Consecutive vowels are always considered separately (ie. Boat yields both Boot and Baat)

  11. Since the letter y represents either a vowel or consonant soun (as we're speaking English), handling it as a vowel or a consonant is allowed, however answers must explicitly state whether they handle y as a vowel or not.

Examples:



Hello world



Hello world!


gives:



Helle werld!
Hollo world!


Excerpt from the original French text (translated), with y handled as a vowel:



An elephant that was rambling all gently in the woods...


gives:



An alaphant that was ramblang all gantla an tha waads...
En elephent thet wes rembleng ell gentle en the weeds...
In iliphint thit wis rimbling ill gintli in thi wiids...
Yn ylyphynt thyt wys rymblyng yll gyntly yn thy wyyds...
On olophont thot wos romblong oll gontlo on tho woods...


Note the behaviour on leading uppercase vowel: case is kept at its index (rules 8 and 9).



Vowelless example



Input that does not contain any vowel, like:



lgn@hst:~$ rm -rf ./* ~ /


must produce no output, or a single line break.



Single-vowel input



Input containing a single vowel is output as is.



Dad sat at a car and saw a fat bat.


gives:



Dad sat at a car and saw a fat bat.


This is code-golf, so fewest bytecount code wins (nothing but eternal PPCG glory)!










share|improve this question



























    up vote
    15
    down vote

    favorite
    2












    Vowels rhyme: Apples and Bananas



    There is a traditional children's song that repeats the same text over and over, only each time every vowel is replaced with a random vowel, but constant across the current stanza.



    Challenge



    The objective is to propose the shortest code that performs such a transformation on an input text.



    Rules



    1. You must print the rhyme as many times as there are distinct vowels in it.

    2. Each print must be separated with a line break (platform-specific combo of n and r is accepted).

    3. For iteration i, replace each vowel with the ith distinct vowel in the original text.

    4. The input text is a sequence of printable ASCII characters (range [32, 126].

    5. Input will not contain embedded line breaks.

    6. Only vowels characters must be affected, other must be output exactly as input.

    7. Only vowels characters count: nasal vowels, although sounding like vowels (like in French "Tintin"), must not be handled as a single vowel.

    8. Case matters for the output, but is positional (replacing an uppercase vowel is done with the uppercase replacement vowel)

    9. Uppercase vowels are not distinct from their lowercase counterpart (ie a <=> A)

    10. Consecutive vowels are always considered separately (ie. Boat yields both Boot and Baat)

    11. Since the letter y represents either a vowel or consonant soun (as we're speaking English), handling it as a vowel or a consonant is allowed, however answers must explicitly state whether they handle y as a vowel or not.

    Examples:



    Hello world



    Hello world!


    gives:



    Helle werld!
    Hollo world!


    Excerpt from the original French text (translated), with y handled as a vowel:



    An elephant that was rambling all gently in the woods...


    gives:



    An alaphant that was ramblang all gantla an tha waads...
    En elephent thet wes rembleng ell gentle en the weeds...
    In iliphint thit wis rimbling ill gintli in thi wiids...
    Yn ylyphynt thyt wys rymblyng yll gyntly yn thy wyyds...
    On olophont thot wos romblong oll gontlo on tho woods...


    Note the behaviour on leading uppercase vowel: case is kept at its index (rules 8 and 9).



    Vowelless example



    Input that does not contain any vowel, like:



    lgn@hst:~$ rm -rf ./* ~ /


    must produce no output, or a single line break.



    Single-vowel input



    Input containing a single vowel is output as is.



    Dad sat at a car and saw a fat bat.


    gives:



    Dad sat at a car and saw a fat bat.


    This is code-golf, so fewest bytecount code wins (nothing but eternal PPCG glory)!










    share|improve this question

























      up vote
      15
      down vote

      favorite
      2









      up vote
      15
      down vote

      favorite
      2






      2





      Vowels rhyme: Apples and Bananas



      There is a traditional children's song that repeats the same text over and over, only each time every vowel is replaced with a random vowel, but constant across the current stanza.



      Challenge



      The objective is to propose the shortest code that performs such a transformation on an input text.



      Rules



      1. You must print the rhyme as many times as there are distinct vowels in it.

      2. Each print must be separated with a line break (platform-specific combo of n and r is accepted).

      3. For iteration i, replace each vowel with the ith distinct vowel in the original text.

      4. The input text is a sequence of printable ASCII characters (range [32, 126].

      5. Input will not contain embedded line breaks.

      6. Only vowels characters must be affected, other must be output exactly as input.

      7. Only vowels characters count: nasal vowels, although sounding like vowels (like in French "Tintin"), must not be handled as a single vowel.

      8. Case matters for the output, but is positional (replacing an uppercase vowel is done with the uppercase replacement vowel)

      9. Uppercase vowels are not distinct from their lowercase counterpart (ie a <=> A)

      10. Consecutive vowels are always considered separately (ie. Boat yields both Boot and Baat)

      11. Since the letter y represents either a vowel or consonant soun (as we're speaking English), handling it as a vowel or a consonant is allowed, however answers must explicitly state whether they handle y as a vowel or not.

      Examples:



      Hello world



      Hello world!


      gives:



      Helle werld!
      Hollo world!


      Excerpt from the original French text (translated), with y handled as a vowel:



      An elephant that was rambling all gently in the woods...


      gives:



      An alaphant that was ramblang all gantla an tha waads...
      En elephent thet wes rembleng ell gentle en the weeds...
      In iliphint thit wis rimbling ill gintli in thi wiids...
      Yn ylyphynt thyt wys rymblyng yll gyntly yn thy wyyds...
      On olophont thot wos romblong oll gontlo on tho woods...


      Note the behaviour on leading uppercase vowel: case is kept at its index (rules 8 and 9).



      Vowelless example



      Input that does not contain any vowel, like:



      lgn@hst:~$ rm -rf ./* ~ /


      must produce no output, or a single line break.



      Single-vowel input



      Input containing a single vowel is output as is.



      Dad sat at a car and saw a fat bat.


      gives:



      Dad sat at a car and saw a fat bat.


      This is code-golf, so fewest bytecount code wins (nothing but eternal PPCG glory)!










      share|improve this question















      Vowels rhyme: Apples and Bananas



      There is a traditional children's song that repeats the same text over and over, only each time every vowel is replaced with a random vowel, but constant across the current stanza.



      Challenge



      The objective is to propose the shortest code that performs such a transformation on an input text.



      Rules



      1. You must print the rhyme as many times as there are distinct vowels in it.

      2. Each print must be separated with a line break (platform-specific combo of n and r is accepted).

      3. For iteration i, replace each vowel with the ith distinct vowel in the original text.

      4. The input text is a sequence of printable ASCII characters (range [32, 126].

      5. Input will not contain embedded line breaks.

      6. Only vowels characters must be affected, other must be output exactly as input.

      7. Only vowels characters count: nasal vowels, although sounding like vowels (like in French "Tintin"), must not be handled as a single vowel.

      8. Case matters for the output, but is positional (replacing an uppercase vowel is done with the uppercase replacement vowel)

      9. Uppercase vowels are not distinct from their lowercase counterpart (ie a <=> A)

      10. Consecutive vowels are always considered separately (ie. Boat yields both Boot and Baat)

      11. Since the letter y represents either a vowel or consonant soun (as we're speaking English), handling it as a vowel or a consonant is allowed, however answers must explicitly state whether they handle y as a vowel or not.

      Examples:



      Hello world



      Hello world!


      gives:



      Helle werld!
      Hollo world!


      Excerpt from the original French text (translated), with y handled as a vowel:



      An elephant that was rambling all gently in the woods...


      gives:



      An alaphant that was ramblang all gantla an tha waads...
      En elephent thet wes rembleng ell gentle en the weeds...
      In iliphint thit wis rimbling ill gintli in thi wiids...
      Yn ylyphynt thyt wys rymblyng yll gyntly yn thy wyyds...
      On olophont thot wos romblong oll gontlo on tho woods...


      Note the behaviour on leading uppercase vowel: case is kept at its index (rules 8 and 9).



      Vowelless example



      Input that does not contain any vowel, like:



      lgn@hst:~$ rm -rf ./* ~ /


      must produce no output, or a single line break.



      Single-vowel input



      Input containing a single vowel is output as is.



      Dad sat at a car and saw a fat bat.


      gives:



      Dad sat at a car and saw a fat bat.


      This is code-golf, so fewest bytecount code wins (nothing but eternal PPCG glory)!







      code-golf string






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 2 at 18:09

























      asked Sep 2 at 17:19









      joH1

      296210




      296210




















          14 Answers
          14






          active

          oldest

          votes

















          up vote
          6
          down vote














          Retina, 45 bytes



          ~(K`AEIOU
          L$`\?(.)
          ./$1/i&$*T`Vv`5*$&$L$&


          Try it online! Does not count y as a vowel. Explanation:



          K`AEIOU


          Replaces the text with the literal string AEIOU.



          L$`\?(.)


          Matches each letter optionally preceded by a backslash.



          ./$1/i&$*T`Vv`5*$&$L$&


          Outputs a line of Retina code for each letter.



          ~(


          Evaluates the generated code (shown below) using the original input. The . causes the code not to output the (final) buffer. The /<vowel>/i& causes the rest of the line to run only if the input contains the given vowel (case-insensitively). The * causes the result of the line to be ignored, so that the next vowel can be tested. The causes the result to be printed on its own line before it is ignored. The T`Vv`AAAAAa transliterates uppercase Vowels to AAAAAs and all lowercase vowels to a. A is an escape that refers to ASCII 07 (BEL), but E, O and o are built-in character classes that needs to be escaped to give their literal values (e is not a character class, but fortunately it is also not an escape.)



          ./A/i&*T`Vv`AAAAAa
          ./E/i&*T`Vv`EEEEEe
          ./I/i&*T`Vv`IIIIIi
          ./O/i&*T`Vv`OOOOOo
          ./U/i&*T`Vv`UUUUUu





          share|improve this answer




















          • Mmh, self-generating code. I don't know Retina well but that's impressive!
            – joH1
            Sep 2 at 18:57










          • @joH1 Well, for me the impressive bit is that it saved 60 bytes!
            – Neil
            Sep 2 at 19:19

















          up vote
          5
          down vote














          Ruby, 78 bytes





          ->ss.downcase.scan(/[aeiou]/).uniq.map*?n


          Try it online!



          A quick and naive approach. Y is not considered a vowel.






          share|improve this answer



























            up vote
            4
            down vote













            bash, 96 bytes



            Two equal-length solutions:





            v=aeiouAEIOU;for x in `grep -o [$v]<<<$1|sed 's/./L&&&&&U&/'|awk !a[\$0]++`; tr $v $x<<<$1;
            v=aeiouAEIOU;for x in `tr -cd $v<<<$1|sed 's/./L&&&&&U&n/g'|awk !a[\$0]++`; tr $v $x<<<$1;


            Try it online!



            Takes input as a command line argument and outputs to STDOUT.






            share|improve this answer



























              up vote
              4
              down vote














              05AB1E (legacy), 19 bytes



              (Indirectly) saved one byte thanks to Kevin (printing directly inside the loop rather than joining, only work in the legacy version).



              lžMÃÙεžMDu«s5×Du«‡=


              Try it online!



              Using the Elixir rewrite, 20 bytes



              lžMÃÙεžMDu«s5×Du«‡}»


              Try it online! (without y) | Try it online! (with y, žM being replaced by žO – same applies for the legacy version)



              How it works



              lžMÃÙεžMDu«s5×Du«‡}» Full program. Example: "Hello"
              l Convert the input to lowercase. "Hello" –> "hello"
              žMÃ Keep only lowercase vowels. "hello" –> "eo"
              Ù Remove duplicates. "eo" –> "eo"
              ε } For each of the characters (example with "e"):
              žMDu« Yield "aeiouAEIOU"
              s5× Swap, and repeat the current char 5 times. "e" –> "eeeee"
              Du« Duplicate, uppercase and merge. "eeeee" –> "eeeeeEEEE"
              ‡ Transliteration. For each item in B, replace it in A with
              the corresponding item in C.
              » Join on newlines.





              share|improve this answer






















              • Nice answer, shorter than the 21 byte answer I prepared. You can golf one more byte by looping and printing instead of mapping: 19 bytes. Your TIO with y should also use 6 instead of 5, btw.
                – Kevin Cruijssen
                Sep 3 at 9:17











              • @KevinCruijssen Edited, thanks! About the y-vowel version, I accidentally copied the wrong TIO link when I answered :|...
                – Mr. Xcoder
                Sep 3 at 9:22










              • Ah, now I know again why I had the i in my code.. Your answer fails for inputs without vowels. Expected is an empty output, but it actually prints the input itself.. :(
                – Kevin Cruijssen
                Sep 3 at 9:31






              • 1




                @KevinCruijssen The 20-byter works, so I rolled back and fixed the second link.
                – Mr. Xcoder
                Sep 3 at 9:34

















              up vote
              4
              down vote













              Japt v2.0a0 -R, 24 22 bytes



              Treats y as a vowel. Change both occurences of y to v to treat it as a consonant.



              v fy â £ry_Xc^H*ZøZu


              Try it




              Explanation



              v :Lowercase
              y :RegEx /[aeiouy]/gi (v is /[aeiou]/gi)
              f :Get all matches as an array
              â :Deduplicate
              £ :Map each X
              ry : Replace all matches of the RegEx above in the input
              _ : Pass matches through a function as Z
              Xc^ : XOR the character code of X with
              H* : 32 multiplied by
              Zø : Does Z contain
              Zu : Uppercase Z
              :Implicitly join with newlines and output





              share|improve this answer





























                up vote
                3
                down vote














                Jelly,  23 20 18  17 bytes



                -2 Thanks to Erik the Outgolfer



                ØcŒHZx5fƇðØc,yð€Y


                To treat y as a vowel replace both cs with ys.



                Try it online!



                How?



                ØcŒHZx5fƇðØc,yð€Y - Link: list of characters, S
                Øc - vowels -> "AEIOUaeiou"
                Ã…Â’H - split in half -> ["AEIOU", "aeiou"]
                Z - transpose -> ["Aa", "Ee", "Ii", "Oo", "Uu"]
                x5 - times 5 -> ["AAAAAaaaaa", "EEEEEeeeee", "IIIIIiiiii", "OOOOOooooo", "UUUUUuuuuu"]
                Ƈ - filter keep if:
                f - filter keep only -> those of X which have required vowels
                - ...i.e. if S = "blah" then ["AAAAAaaaaa"]
                ð ð€ - dyadic chain for €ach:
                Øc - vowels -> "AEIOUaeiou"
                , - pair e.g. ["AEIOUaeiou","AAAAAaaaaa"]
                y - translate e.g. swap A for A, E for A, ...
                Y - join with newlines





                share|improve this answer






















                • 18 bytes (trivial) (ż/ on a pair is Z, two dyads in a row where the left one is unpaired in a monad have the argument in-between implicitly)
                  – Erik the Outgolfer
                  Sep 2 at 19:40











                • Thanks (Z >_<), not sure what was going on with my TIO session, but removing the redundant ð wasn't working; restart fixed.
                  – Jonathan Allan
                  Sep 2 at 19:54











                • TBH, I actually fixed x€ → x too, but you ninja'd me. :P
                  – Erik the Outgolfer
                  Sep 2 at 19:55

















                up vote
                3
                down vote














                Red, 229 bytes



                Taking y for a non-vowel



                func[s][v: charset"aoeiu"w: charset"AOEIU"p: copy""parse s[any[[copy c[v | w](if not find p c[append p c lowercase c
                parse s[any[[copy n to[v | w | end]](prin n)opt[v(prin c)|[w(prin uppercase copy c)]| skip]]]print""])]| skip]]]


                Try it online!



                Slightly more readable:



                f: func [ s ] [
                v: charset "aoeiu"
                w: charset "AOEIU"
                p: copy ""
                parse s[
                any [
                [ copy c [ v | w ]
                ( if not find p c [
                append p c
                lowercase c
                parse s [
                any [
                [ copy n to [ v | w | end ] ]
                ( prin n )
                opt [ v ( prin c )
                | [ w ( prin uppercase copy c ) ]
                | skip
                ]
                ]
                ]
                print ""
                ] )
                ]
                | skip
                ]
                ]
                ]





                share|improve this answer





























                  up vote
                  3
                  down vote














                  R, 138, 129 bytes





                  function(x,U=utf8ToInt,a=U(V<-'aeiouAEIOU'))for(i in (which(a%in%U(x))-1)%%5)cat(chartr(V,intToUtf8(rep(a[i+c(1,6)],e=5)),x),'
                  ')


                  Try it online!




                  • y is not considered a vowel





                  share|improve this answer





























                    up vote
                    2
                    down vote













                    Python, 129 119 112 bytes



                    import re
                    f=lambda s:'n'.join(r('[AEIOU]',v.upper(),r('[aeiou]',v,s))for v in'aeiou'if v in s.lower());r=re.sub


                    Try it Online!



                    Doesn't treat $y$ as vowel.



                    -7 bytes thanks to @Mr.Xcoder






                    share|improve this answer






















                    • Glad to see you could get it working and golfed down a bit! Nice work
                      – joH1
                      Sep 2 at 20:34










                    • @joH1 Thanks :)
                      – DimChtz
                      Sep 2 at 20:37










                    • 112 bytes.
                      – Mr. Xcoder
                      Sep 2 at 21:53


















                    up vote
                    2
                    down vote














                    JavaScript (Node.js), 99 bytes



                    Treats $y$ as a consonant.





                    s=>(g=F=>Buffer(s).map(c=>2130466>>c&c>64?F(c):c)+`
                    `)(v=>g[v&=31]||(g[v]=S+=g(c=>c&96|v)),S='')&&S


                    Try it online!



                    Commented



                    s => ( // s = input string
                    g = F => // g = helper function taking a callback function F
                    Buffer(s) // turn s into a Buffer
                    .map(c => // for each ASCII code c in s:
                    2130466 // 2130466 is a vowel bitmask: 1000001000001000100010
                    // u o i e a
                    >> c // the ECMAScript specification enforces that the shiftCount is
                    // the result of masking out all but the least significant 5 bits
                    & c > 64 // also make sure to ignore non-letter characters
                    ? // if a vowel is identified:
                    F(c) // invoke F with c
                    : // else:
                    c // just yield c
                    ) + `n` // end of map(); coerce back to a string and append a newline
                    )(v => // invoke g with a callback that takes v:
                    g[v &= 31] || ( // unless this vowel has already been encountered:
                    g[v] = // mark it as encountered
                    S += // and append to the output string S
                    g( // the result of another call to g:
                    c => c & 96 | v // where vowels are replaced with v, using the original case
                    ) // end of inner call to g
                    ), //
                    S = '' // start with S = ''
                    ) && S // end of outer call to g; return S





                    share|improve this answer





























                      up vote
                      2
                      down vote













                      Java 10, 196 188 bytes





                      s->var d=new int[99];for(var c:s.toUpperCase().replaceAll("[^AEIOU]","").toCharArray())if(d[c]++<1)System.out.println(s.replaceAll("[AEIOU]",c+"").replaceAll("[aeiou]",(char)(c+32)+""));


                      -8 bytes thanks to @joH1.



                      Without y as vowel to save bytes.



                      Try it online.



                      Explanation:



                      s-> // Method with String parameter and no return-type
                      var d=new int[99]; // Integer-array indicating which vowels we've already output
                      for(var c:s.toUpperCase()// Convert the input to uppercase
                      .replaceAll("[^AEIOU]","")
                      // Remove all non-vowels
                      .toCharArray())// Convert it to a character array)
                      // And loop over those vowel-characters
                      if(d[c]++ // Increase the vowel-count by 1
                      <1) // And if it was 0 this iteration:
                      System.out.println( // Print with trailing newline:
                      s // The input,
                      .replaceAll("[AEIOU]",c+"")
                      // with every uppercase vowel replace with the current vowel
                      .replaceAll("[aeiou]",(char)(c+32)+""));
                      // and every lowercase vowel replaced as well





                      share|improve this answer






















                      • 188 bytes by inlining the variable v in the loop
                        – joH1
                        Sep 4 at 9:03










                      • @joH1 Thanks, not sure how I missed that..
                        – Kevin Cruijssen
                        Sep 4 at 9:07

















                      up vote
                      1
                      down vote














                      Python 2, 112 bytes





                      s=input()
                      V='aeiouAEIOU'
                      for v in V:
                      if v in s.lower():print''.join([c,[v.upper(),v][c>'Z']][c in V]for c in s)


                      Try it online!



                      Treats y as a consonant.






                      share|improve this answer



























                        up vote
                        1
                        down vote














                        Perl 6, 64 bytes





                        m:g:i/<[aeiou]>/».lc.unique».&$^v;say S:g:ii[<[aeiou]>]=$v


                        Try it online!






                        share|improve this answer



























                          up vote
                          1
                          down vote














                          Java (OpenJDK 8), 184 bytes



                          y is a vowel





                          s->s.chars().mapToObj(c->""+(char)(c>96?c:c+32)).filter("aeiouy"::contains).distinct().forEach(c->System.out.println(s.replaceAll("[aeiouy]",c).replaceAll("[AEIOUY]",c.toUpperCase())))


                          Try it online!






                          share|improve this answer






















                            Your Answer




                            StackExchange.ifUsing("editor", function ()
                            return StackExchange.using("mathjaxEditing", function ()
                            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
                            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                            );
                            );
                            , "mathjax-editing");

                            StackExchange.ifUsing("editor", function ()
                            StackExchange.using("externalEditor", function ()
                            StackExchange.using("snippets", function ()
                            StackExchange.snippets.init();
                            );
                            );
                            , "code-snippets");

                            StackExchange.ready(function()
                            var channelOptions =
                            tags: "".split(" "),
                            id: "200"
                            ;
                            initTagRenderer("".split(" "), "".split(" "), channelOptions);

                            StackExchange.using("externalEditor", function()
                            // Have to fire editor after snippets, if snippets enabled
                            if (StackExchange.settings.snippets.snippetsEnabled)
                            StackExchange.using("snippets", function()
                            createEditor();
                            );

                            else
                            createEditor();

                            );

                            function createEditor()
                            StackExchange.prepareEditor(
                            heartbeatType: 'answer',
                            convertImagesToLinks: false,
                            noModals: false,
                            showLowRepImageUploadWarning: true,
                            reputationToPostImages: null,
                            bindNavPrevention: true,
                            postfix: "",
                            onDemand: true,
                            discardSelector: ".discard-answer"
                            ,immediatelyShowMarkdownHelp:true
                            );



                            );













                             

                            draft saved


                            draft discarded


















                            StackExchange.ready(
                            function ()
                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f171588%2frepeat-a-rhyme-and-loop-on-the-vowels%23new-answer', 'question_page');

                            );

                            Post as a guest






























                            14 Answers
                            14






                            active

                            oldest

                            votes








                            14 Answers
                            14






                            active

                            oldest

                            votes









                            active

                            oldest

                            votes






                            active

                            oldest

                            votes








                            up vote
                            6
                            down vote














                            Retina, 45 bytes



                            ~(K`AEIOU
                            L$`\?(.)
                            ./$1/i&$*T`Vv`5*$&$L$&


                            Try it online! Does not count y as a vowel. Explanation:



                            K`AEIOU


                            Replaces the text with the literal string AEIOU.



                            L$`\?(.)


                            Matches each letter optionally preceded by a backslash.



                            ./$1/i&$*T`Vv`5*$&$L$&


                            Outputs a line of Retina code for each letter.



                            ~(


                            Evaluates the generated code (shown below) using the original input. The . causes the code not to output the (final) buffer. The /<vowel>/i& causes the rest of the line to run only if the input contains the given vowel (case-insensitively). The * causes the result of the line to be ignored, so that the next vowel can be tested. The causes the result to be printed on its own line before it is ignored. The T`Vv`AAAAAa transliterates uppercase Vowels to AAAAAs and all lowercase vowels to a. A is an escape that refers to ASCII 07 (BEL), but E, O and o are built-in character classes that needs to be escaped to give their literal values (e is not a character class, but fortunately it is also not an escape.)



                            ./A/i&*T`Vv`AAAAAa
                            ./E/i&*T`Vv`EEEEEe
                            ./I/i&*T`Vv`IIIIIi
                            ./O/i&*T`Vv`OOOOOo
                            ./U/i&*T`Vv`UUUUUu





                            share|improve this answer




















                            • Mmh, self-generating code. I don't know Retina well but that's impressive!
                              – joH1
                              Sep 2 at 18:57










                            • @joH1 Well, for me the impressive bit is that it saved 60 bytes!
                              – Neil
                              Sep 2 at 19:19














                            up vote
                            6
                            down vote














                            Retina, 45 bytes



                            ~(K`AEIOU
                            L$`\?(.)
                            ./$1/i&$*T`Vv`5*$&$L$&


                            Try it online! Does not count y as a vowel. Explanation:



                            K`AEIOU


                            Replaces the text with the literal string AEIOU.



                            L$`\?(.)


                            Matches each letter optionally preceded by a backslash.



                            ./$1/i&$*T`Vv`5*$&$L$&


                            Outputs a line of Retina code for each letter.



                            ~(


                            Evaluates the generated code (shown below) using the original input. The . causes the code not to output the (final) buffer. The /<vowel>/i& causes the rest of the line to run only if the input contains the given vowel (case-insensitively). The * causes the result of the line to be ignored, so that the next vowel can be tested. The causes the result to be printed on its own line before it is ignored. The T`Vv`AAAAAa transliterates uppercase Vowels to AAAAAs and all lowercase vowels to a. A is an escape that refers to ASCII 07 (BEL), but E, O and o are built-in character classes that needs to be escaped to give their literal values (e is not a character class, but fortunately it is also not an escape.)



                            ./A/i&*T`Vv`AAAAAa
                            ./E/i&*T`Vv`EEEEEe
                            ./I/i&*T`Vv`IIIIIi
                            ./O/i&*T`Vv`OOOOOo
                            ./U/i&*T`Vv`UUUUUu





                            share|improve this answer




















                            • Mmh, self-generating code. I don't know Retina well but that's impressive!
                              – joH1
                              Sep 2 at 18:57










                            • @joH1 Well, for me the impressive bit is that it saved 60 bytes!
                              – Neil
                              Sep 2 at 19:19












                            up vote
                            6
                            down vote










                            up vote
                            6
                            down vote










                            Retina, 45 bytes



                            ~(K`AEIOU
                            L$`\?(.)
                            ./$1/i&$*T`Vv`5*$&$L$&


                            Try it online! Does not count y as a vowel. Explanation:



                            K`AEIOU


                            Replaces the text with the literal string AEIOU.



                            L$`\?(.)


                            Matches each letter optionally preceded by a backslash.



                            ./$1/i&$*T`Vv`5*$&$L$&


                            Outputs a line of Retina code for each letter.



                            ~(


                            Evaluates the generated code (shown below) using the original input. The . causes the code not to output the (final) buffer. The /<vowel>/i& causes the rest of the line to run only if the input contains the given vowel (case-insensitively). The * causes the result of the line to be ignored, so that the next vowel can be tested. The causes the result to be printed on its own line before it is ignored. The T`Vv`AAAAAa transliterates uppercase Vowels to AAAAAs and all lowercase vowels to a. A is an escape that refers to ASCII 07 (BEL), but E, O and o are built-in character classes that needs to be escaped to give their literal values (e is not a character class, but fortunately it is also not an escape.)



                            ./A/i&*T`Vv`AAAAAa
                            ./E/i&*T`Vv`EEEEEe
                            ./I/i&*T`Vv`IIIIIi
                            ./O/i&*T`Vv`OOOOOo
                            ./U/i&*T`Vv`UUUUUu





                            share|improve this answer













                            Retina, 45 bytes



                            ~(K`AEIOU
                            L$`\?(.)
                            ./$1/i&$*T`Vv`5*$&$L$&


                            Try it online! Does not count y as a vowel. Explanation:



                            K`AEIOU


                            Replaces the text with the literal string AEIOU.



                            L$`\?(.)


                            Matches each letter optionally preceded by a backslash.



                            ./$1/i&$*T`Vv`5*$&$L$&


                            Outputs a line of Retina code for each letter.



                            ~(


                            Evaluates the generated code (shown below) using the original input. The . causes the code not to output the (final) buffer. The /<vowel>/i& causes the rest of the line to run only if the input contains the given vowel (case-insensitively). The * causes the result of the line to be ignored, so that the next vowel can be tested. The causes the result to be printed on its own line before it is ignored. The T`Vv`AAAAAa transliterates uppercase Vowels to AAAAAs and all lowercase vowels to a. A is an escape that refers to ASCII 07 (BEL), but E, O and o are built-in character classes that needs to be escaped to give their literal values (e is not a character class, but fortunately it is also not an escape.)



                            ./A/i&*T`Vv`AAAAAa
                            ./E/i&*T`Vv`EEEEEe
                            ./I/i&*T`Vv`IIIIIi
                            ./O/i&*T`Vv`OOOOOo
                            ./U/i&*T`Vv`UUUUUu






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Sep 2 at 18:43









                            Neil

                            75.7k744171




                            75.7k744171











                            • Mmh, self-generating code. I don't know Retina well but that's impressive!
                              – joH1
                              Sep 2 at 18:57










                            • @joH1 Well, for me the impressive bit is that it saved 60 bytes!
                              – Neil
                              Sep 2 at 19:19
















                            • Mmh, self-generating code. I don't know Retina well but that's impressive!
                              – joH1
                              Sep 2 at 18:57










                            • @joH1 Well, for me the impressive bit is that it saved 60 bytes!
                              – Neil
                              Sep 2 at 19:19















                            Mmh, self-generating code. I don't know Retina well but that's impressive!
                            – joH1
                            Sep 2 at 18:57




                            Mmh, self-generating code. I don't know Retina well but that's impressive!
                            – joH1
                            Sep 2 at 18:57












                            @joH1 Well, for me the impressive bit is that it saved 60 bytes!
                            – Neil
                            Sep 2 at 19:19




                            @joH1 Well, for me the impressive bit is that it saved 60 bytes!
                            – Neil
                            Sep 2 at 19:19










                            up vote
                            5
                            down vote














                            Ruby, 78 bytes





                            ->ss.downcase.scan(/[aeiou]/).uniq.map*?n


                            Try it online!



                            A quick and naive approach. Y is not considered a vowel.






                            share|improve this answer
























                              up vote
                              5
                              down vote














                              Ruby, 78 bytes





                              ->ss.downcase.scan(/[aeiou]/).uniq.map*?n


                              Try it online!



                              A quick and naive approach. Y is not considered a vowel.






                              share|improve this answer






















                                up vote
                                5
                                down vote










                                up vote
                                5
                                down vote










                                Ruby, 78 bytes





                                ->ss.downcase.scan(/[aeiou]/).uniq.map*?n


                                Try it online!



                                A quick and naive approach. Y is not considered a vowel.






                                share|improve this answer













                                Ruby, 78 bytes





                                ->ss.downcase.scan(/[aeiou]/).uniq.map*?n


                                Try it online!



                                A quick and naive approach. Y is not considered a vowel.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Sep 2 at 18:22









                                Kirill L.

                                2,6661117




                                2,6661117




















                                    up vote
                                    4
                                    down vote













                                    bash, 96 bytes



                                    Two equal-length solutions:





                                    v=aeiouAEIOU;for x in `grep -o [$v]<<<$1|sed 's/./L&&&&&U&/'|awk !a[\$0]++`; tr $v $x<<<$1;
                                    v=aeiouAEIOU;for x in `tr -cd $v<<<$1|sed 's/./L&&&&&U&n/g'|awk !a[\$0]++`; tr $v $x<<<$1;


                                    Try it online!



                                    Takes input as a command line argument and outputs to STDOUT.






                                    share|improve this answer
























                                      up vote
                                      4
                                      down vote













                                      bash, 96 bytes



                                      Two equal-length solutions:





                                      v=aeiouAEIOU;for x in `grep -o [$v]<<<$1|sed 's/./L&&&&&U&/'|awk !a[\$0]++`; tr $v $x<<<$1;
                                      v=aeiouAEIOU;for x in `tr -cd $v<<<$1|sed 's/./L&&&&&U&n/g'|awk !a[\$0]++`; tr $v $x<<<$1;


                                      Try it online!



                                      Takes input as a command line argument and outputs to STDOUT.






                                      share|improve this answer






















                                        up vote
                                        4
                                        down vote










                                        up vote
                                        4
                                        down vote









                                        bash, 96 bytes



                                        Two equal-length solutions:





                                        v=aeiouAEIOU;for x in `grep -o [$v]<<<$1|sed 's/./L&&&&&U&/'|awk !a[\$0]++`; tr $v $x<<<$1;
                                        v=aeiouAEIOU;for x in `tr -cd $v<<<$1|sed 's/./L&&&&&U&n/g'|awk !a[\$0]++`; tr $v $x<<<$1;


                                        Try it online!



                                        Takes input as a command line argument and outputs to STDOUT.






                                        share|improve this answer












                                        bash, 96 bytes



                                        Two equal-length solutions:





                                        v=aeiouAEIOU;for x in `grep -o [$v]<<<$1|sed 's/./L&&&&&U&/'|awk !a[\$0]++`; tr $v $x<<<$1;
                                        v=aeiouAEIOU;for x in `tr -cd $v<<<$1|sed 's/./L&&&&&U&n/g'|awk !a[\$0]++`; tr $v $x<<<$1;


                                        Try it online!



                                        Takes input as a command line argument and outputs to STDOUT.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Sep 2 at 21:17









                                        Doorknob♦

                                        53.7k16112340




                                        53.7k16112340




















                                            up vote
                                            4
                                            down vote














                                            05AB1E (legacy), 19 bytes



                                            (Indirectly) saved one byte thanks to Kevin (printing directly inside the loop rather than joining, only work in the legacy version).



                                            lžMÃÙεžMDu«s5×Du«‡=


                                            Try it online!



                                            Using the Elixir rewrite, 20 bytes



                                            lžMÃÙεžMDu«s5×Du«‡}»


                                            Try it online! (without y) | Try it online! (with y, žM being replaced by žO – same applies for the legacy version)



                                            How it works



                                            lžMÃÙεžMDu«s5×Du«‡}» Full program. Example: "Hello"
                                            l Convert the input to lowercase. "Hello" –> "hello"
                                            žMÃ Keep only lowercase vowels. "hello" –> "eo"
                                            Ù Remove duplicates. "eo" –> "eo"
                                            ε } For each of the characters (example with "e"):
                                            žMDu« Yield "aeiouAEIOU"
                                            s5× Swap, and repeat the current char 5 times. "e" –> "eeeee"
                                            Du« Duplicate, uppercase and merge. "eeeee" –> "eeeeeEEEE"
                                            ‡ Transliteration. For each item in B, replace it in A with
                                            the corresponding item in C.
                                            » Join on newlines.





                                            share|improve this answer






















                                            • Nice answer, shorter than the 21 byte answer I prepared. You can golf one more byte by looping and printing instead of mapping: 19 bytes. Your TIO with y should also use 6 instead of 5, btw.
                                              – Kevin Cruijssen
                                              Sep 3 at 9:17











                                            • @KevinCruijssen Edited, thanks! About the y-vowel version, I accidentally copied the wrong TIO link when I answered :|...
                                              – Mr. Xcoder
                                              Sep 3 at 9:22










                                            • Ah, now I know again why I had the i in my code.. Your answer fails for inputs without vowels. Expected is an empty output, but it actually prints the input itself.. :(
                                              – Kevin Cruijssen
                                              Sep 3 at 9:31






                                            • 1




                                              @KevinCruijssen The 20-byter works, so I rolled back and fixed the second link.
                                              – Mr. Xcoder
                                              Sep 3 at 9:34














                                            up vote
                                            4
                                            down vote














                                            05AB1E (legacy), 19 bytes



                                            (Indirectly) saved one byte thanks to Kevin (printing directly inside the loop rather than joining, only work in the legacy version).



                                            lžMÃÙεžMDu«s5×Du«‡=


                                            Try it online!



                                            Using the Elixir rewrite, 20 bytes



                                            lžMÃÙεžMDu«s5×Du«‡}»


                                            Try it online! (without y) | Try it online! (with y, žM being replaced by žO – same applies for the legacy version)



                                            How it works



                                            lžMÃÙεžMDu«s5×Du«‡}» Full program. Example: "Hello"
                                            l Convert the input to lowercase. "Hello" –> "hello"
                                            žMÃ Keep only lowercase vowels. "hello" –> "eo"
                                            Ù Remove duplicates. "eo" –> "eo"
                                            ε } For each of the characters (example with "e"):
                                            žMDu« Yield "aeiouAEIOU"
                                            s5× Swap, and repeat the current char 5 times. "e" –> "eeeee"
                                            Du« Duplicate, uppercase and merge. "eeeee" –> "eeeeeEEEE"
                                            ‡ Transliteration. For each item in B, replace it in A with
                                            the corresponding item in C.
                                            » Join on newlines.





                                            share|improve this answer






















                                            • Nice answer, shorter than the 21 byte answer I prepared. You can golf one more byte by looping and printing instead of mapping: 19 bytes. Your TIO with y should also use 6 instead of 5, btw.
                                              – Kevin Cruijssen
                                              Sep 3 at 9:17











                                            • @KevinCruijssen Edited, thanks! About the y-vowel version, I accidentally copied the wrong TIO link when I answered :|...
                                              – Mr. Xcoder
                                              Sep 3 at 9:22










                                            • Ah, now I know again why I had the i in my code.. Your answer fails for inputs without vowels. Expected is an empty output, but it actually prints the input itself.. :(
                                              – Kevin Cruijssen
                                              Sep 3 at 9:31






                                            • 1




                                              @KevinCruijssen The 20-byter works, so I rolled back and fixed the second link.
                                              – Mr. Xcoder
                                              Sep 3 at 9:34












                                            up vote
                                            4
                                            down vote










                                            up vote
                                            4
                                            down vote










                                            05AB1E (legacy), 19 bytes



                                            (Indirectly) saved one byte thanks to Kevin (printing directly inside the loop rather than joining, only work in the legacy version).



                                            lžMÃÙεžMDu«s5×Du«‡=


                                            Try it online!



                                            Using the Elixir rewrite, 20 bytes



                                            lžMÃÙεžMDu«s5×Du«‡}»


                                            Try it online! (without y) | Try it online! (with y, žM being replaced by žO – same applies for the legacy version)



                                            How it works



                                            lžMÃÙεžMDu«s5×Du«‡}» Full program. Example: "Hello"
                                            l Convert the input to lowercase. "Hello" –> "hello"
                                            žMÃ Keep only lowercase vowels. "hello" –> "eo"
                                            Ù Remove duplicates. "eo" –> "eo"
                                            ε } For each of the characters (example with "e"):
                                            žMDu« Yield "aeiouAEIOU"
                                            s5× Swap, and repeat the current char 5 times. "e" –> "eeeee"
                                            Du« Duplicate, uppercase and merge. "eeeee" –> "eeeeeEEEE"
                                            ‡ Transliteration. For each item in B, replace it in A with
                                            the corresponding item in C.
                                            » Join on newlines.





                                            share|improve this answer















                                            05AB1E (legacy), 19 bytes



                                            (Indirectly) saved one byte thanks to Kevin (printing directly inside the loop rather than joining, only work in the legacy version).



                                            lžMÃÙεžMDu«s5×Du«‡=


                                            Try it online!



                                            Using the Elixir rewrite, 20 bytes



                                            lžMÃÙεžMDu«s5×Du«‡}»


                                            Try it online! (without y) | Try it online! (with y, žM being replaced by žO – same applies for the legacy version)



                                            How it works



                                            lžMÃÙεžMDu«s5×Du«‡}» Full program. Example: "Hello"
                                            l Convert the input to lowercase. "Hello" –> "hello"
                                            žMÃ Keep only lowercase vowels. "hello" –> "eo"
                                            Ù Remove duplicates. "eo" –> "eo"
                                            ε } For each of the characters (example with "e"):
                                            žMDu« Yield "aeiouAEIOU"
                                            s5× Swap, and repeat the current char 5 times. "e" –> "eeeee"
                                            Du« Duplicate, uppercase and merge. "eeeee" –> "eeeeeEEEE"
                                            ‡ Transliteration. For each item in B, replace it in A with
                                            the corresponding item in C.
                                            » Join on newlines.






                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited Sep 3 at 11:30

























                                            answered Sep 2 at 21:38









                                            Mr. Xcoder

                                            30.6k758194




                                            30.6k758194











                                            • Nice answer, shorter than the 21 byte answer I prepared. You can golf one more byte by looping and printing instead of mapping: 19 bytes. Your TIO with y should also use 6 instead of 5, btw.
                                              – Kevin Cruijssen
                                              Sep 3 at 9:17











                                            • @KevinCruijssen Edited, thanks! About the y-vowel version, I accidentally copied the wrong TIO link when I answered :|...
                                              – Mr. Xcoder
                                              Sep 3 at 9:22










                                            • Ah, now I know again why I had the i in my code.. Your answer fails for inputs without vowels. Expected is an empty output, but it actually prints the input itself.. :(
                                              – Kevin Cruijssen
                                              Sep 3 at 9:31






                                            • 1




                                              @KevinCruijssen The 20-byter works, so I rolled back and fixed the second link.
                                              – Mr. Xcoder
                                              Sep 3 at 9:34
















                                            • Nice answer, shorter than the 21 byte answer I prepared. You can golf one more byte by looping and printing instead of mapping: 19 bytes. Your TIO with y should also use 6 instead of 5, btw.
                                              – Kevin Cruijssen
                                              Sep 3 at 9:17











                                            • @KevinCruijssen Edited, thanks! About the y-vowel version, I accidentally copied the wrong TIO link when I answered :|...
                                              – Mr. Xcoder
                                              Sep 3 at 9:22










                                            • Ah, now I know again why I had the i in my code.. Your answer fails for inputs without vowels. Expected is an empty output, but it actually prints the input itself.. :(
                                              – Kevin Cruijssen
                                              Sep 3 at 9:31






                                            • 1




                                              @KevinCruijssen The 20-byter works, so I rolled back and fixed the second link.
                                              – Mr. Xcoder
                                              Sep 3 at 9:34















                                            Nice answer, shorter than the 21 byte answer I prepared. You can golf one more byte by looping and printing instead of mapping: 19 bytes. Your TIO with y should also use 6 instead of 5, btw.
                                            – Kevin Cruijssen
                                            Sep 3 at 9:17





                                            Nice answer, shorter than the 21 byte answer I prepared. You can golf one more byte by looping and printing instead of mapping: 19 bytes. Your TIO with y should also use 6 instead of 5, btw.
                                            – Kevin Cruijssen
                                            Sep 3 at 9:17













                                            @KevinCruijssen Edited, thanks! About the y-vowel version, I accidentally copied the wrong TIO link when I answered :|...
                                            – Mr. Xcoder
                                            Sep 3 at 9:22




                                            @KevinCruijssen Edited, thanks! About the y-vowel version, I accidentally copied the wrong TIO link when I answered :|...
                                            – Mr. Xcoder
                                            Sep 3 at 9:22












                                            Ah, now I know again why I had the i in my code.. Your answer fails for inputs without vowels. Expected is an empty output, but it actually prints the input itself.. :(
                                            – Kevin Cruijssen
                                            Sep 3 at 9:31




                                            Ah, now I know again why I had the i in my code.. Your answer fails for inputs without vowels. Expected is an empty output, but it actually prints the input itself.. :(
                                            – Kevin Cruijssen
                                            Sep 3 at 9:31




                                            1




                                            1




                                            @KevinCruijssen The 20-byter works, so I rolled back and fixed the second link.
                                            – Mr. Xcoder
                                            Sep 3 at 9:34




                                            @KevinCruijssen The 20-byter works, so I rolled back and fixed the second link.
                                            – Mr. Xcoder
                                            Sep 3 at 9:34










                                            up vote
                                            4
                                            down vote













                                            Japt v2.0a0 -R, 24 22 bytes



                                            Treats y as a vowel. Change both occurences of y to v to treat it as a consonant.



                                            v fy â £ry_Xc^H*ZøZu


                                            Try it




                                            Explanation



                                            v :Lowercase
                                            y :RegEx /[aeiouy]/gi (v is /[aeiou]/gi)
                                            f :Get all matches as an array
                                            â :Deduplicate
                                            £ :Map each X
                                            ry : Replace all matches of the RegEx above in the input
                                            _ : Pass matches through a function as Z
                                            Xc^ : XOR the character code of X with
                                            H* : 32 multiplied by
                                            Zø : Does Z contain
                                            Zu : Uppercase Z
                                            :Implicitly join with newlines and output





                                            share|improve this answer


























                                              up vote
                                              4
                                              down vote













                                              Japt v2.0a0 -R, 24 22 bytes



                                              Treats y as a vowel. Change both occurences of y to v to treat it as a consonant.



                                              v fy â £ry_Xc^H*ZøZu


                                              Try it




                                              Explanation



                                              v :Lowercase
                                              y :RegEx /[aeiouy]/gi (v is /[aeiou]/gi)
                                              f :Get all matches as an array
                                              â :Deduplicate
                                              £ :Map each X
                                              ry : Replace all matches of the RegEx above in the input
                                              _ : Pass matches through a function as Z
                                              Xc^ : XOR the character code of X with
                                              H* : 32 multiplied by
                                              Zø : Does Z contain
                                              Zu : Uppercase Z
                                              :Implicitly join with newlines and output





                                              share|improve this answer
























                                                up vote
                                                4
                                                down vote










                                                up vote
                                                4
                                                down vote









                                                Japt v2.0a0 -R, 24 22 bytes



                                                Treats y as a vowel. Change both occurences of y to v to treat it as a consonant.



                                                v fy â £ry_Xc^H*ZøZu


                                                Try it




                                                Explanation



                                                v :Lowercase
                                                y :RegEx /[aeiouy]/gi (v is /[aeiou]/gi)
                                                f :Get all matches as an array
                                                â :Deduplicate
                                                £ :Map each X
                                                ry : Replace all matches of the RegEx above in the input
                                                _ : Pass matches through a function as Z
                                                Xc^ : XOR the character code of X with
                                                H* : 32 multiplied by
                                                Zø : Does Z contain
                                                Zu : Uppercase Z
                                                :Implicitly join with newlines and output





                                                share|improve this answer














                                                Japt v2.0a0 -R, 24 22 bytes



                                                Treats y as a vowel. Change both occurences of y to v to treat it as a consonant.



                                                v fy â £ry_Xc^H*ZøZu


                                                Try it




                                                Explanation



                                                v :Lowercase
                                                y :RegEx /[aeiouy]/gi (v is /[aeiou]/gi)
                                                f :Get all matches as an array
                                                â :Deduplicate
                                                £ :Map each X
                                                ry : Replace all matches of the RegEx above in the input
                                                _ : Pass matches through a function as Z
                                                Xc^ : XOR the character code of X with
                                                H* : 32 multiplied by
                                                Zø : Does Z contain
                                                Zu : Uppercase Z
                                                :Implicitly join with newlines and output






                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Sep 3 at 14:40

























                                                answered Sep 2 at 17:59









                                                Shaggy

                                                16.8k21661




                                                16.8k21661




















                                                    up vote
                                                    3
                                                    down vote














                                                    Jelly,  23 20 18  17 bytes



                                                    -2 Thanks to Erik the Outgolfer



                                                    ØcŒHZx5fƇðØc,yð€Y


                                                    To treat y as a vowel replace both cs with ys.



                                                    Try it online!



                                                    How?



                                                    ØcŒHZx5fƇðØc,yð€Y - Link: list of characters, S
                                                    Øc - vowels -> "AEIOUaeiou"
                                                    Ã…Â’H - split in half -> ["AEIOU", "aeiou"]
                                                    Z - transpose -> ["Aa", "Ee", "Ii", "Oo", "Uu"]
                                                    x5 - times 5 -> ["AAAAAaaaaa", "EEEEEeeeee", "IIIIIiiiii", "OOOOOooooo", "UUUUUuuuuu"]
                                                    Ƈ - filter keep if:
                                                    f - filter keep only -> those of X which have required vowels
                                                    - ...i.e. if S = "blah" then ["AAAAAaaaaa"]
                                                    ð ð€ - dyadic chain for €ach:
                                                    Øc - vowels -> "AEIOUaeiou"
                                                    , - pair e.g. ["AEIOUaeiou","AAAAAaaaaa"]
                                                    y - translate e.g. swap A for A, E for A, ...
                                                    Y - join with newlines





                                                    share|improve this answer






















                                                    • 18 bytes (trivial) (ż/ on a pair is Z, two dyads in a row where the left one is unpaired in a monad have the argument in-between implicitly)
                                                      – Erik the Outgolfer
                                                      Sep 2 at 19:40











                                                    • Thanks (Z >_<), not sure what was going on with my TIO session, but removing the redundant ð wasn't working; restart fixed.
                                                      – Jonathan Allan
                                                      Sep 2 at 19:54











                                                    • TBH, I actually fixed x€ → x too, but you ninja'd me. :P
                                                      – Erik the Outgolfer
                                                      Sep 2 at 19:55














                                                    up vote
                                                    3
                                                    down vote














                                                    Jelly,  23 20 18  17 bytes



                                                    -2 Thanks to Erik the Outgolfer



                                                    ØcŒHZx5fƇðØc,yð€Y


                                                    To treat y as a vowel replace both cs with ys.



                                                    Try it online!



                                                    How?



                                                    ØcŒHZx5fƇðØc,yð€Y - Link: list of characters, S
                                                    Øc - vowels -> "AEIOUaeiou"
                                                    Ã…Â’H - split in half -> ["AEIOU", "aeiou"]
                                                    Z - transpose -> ["Aa", "Ee", "Ii", "Oo", "Uu"]
                                                    x5 - times 5 -> ["AAAAAaaaaa", "EEEEEeeeee", "IIIIIiiiii", "OOOOOooooo", "UUUUUuuuuu"]
                                                    Ƈ - filter keep if:
                                                    f - filter keep only -> those of X which have required vowels
                                                    - ...i.e. if S = "blah" then ["AAAAAaaaaa"]
                                                    ð ð€ - dyadic chain for €ach:
                                                    Øc - vowels -> "AEIOUaeiou"
                                                    , - pair e.g. ["AEIOUaeiou","AAAAAaaaaa"]
                                                    y - translate e.g. swap A for A, E for A, ...
                                                    Y - join with newlines





                                                    share|improve this answer






















                                                    • 18 bytes (trivial) (ż/ on a pair is Z, two dyads in a row where the left one is unpaired in a monad have the argument in-between implicitly)
                                                      – Erik the Outgolfer
                                                      Sep 2 at 19:40











                                                    • Thanks (Z >_<), not sure what was going on with my TIO session, but removing the redundant ð wasn't working; restart fixed.
                                                      – Jonathan Allan
                                                      Sep 2 at 19:54











                                                    • TBH, I actually fixed x€ → x too, but you ninja'd me. :P
                                                      – Erik the Outgolfer
                                                      Sep 2 at 19:55












                                                    up vote
                                                    3
                                                    down vote










                                                    up vote
                                                    3
                                                    down vote










                                                    Jelly,  23 20 18  17 bytes



                                                    -2 Thanks to Erik the Outgolfer



                                                    ØcŒHZx5fƇðØc,yð€Y


                                                    To treat y as a vowel replace both cs with ys.



                                                    Try it online!



                                                    How?



                                                    ØcŒHZx5fƇðØc,yð€Y - Link: list of characters, S
                                                    Øc - vowels -> "AEIOUaeiou"
                                                    Ã…Â’H - split in half -> ["AEIOU", "aeiou"]
                                                    Z - transpose -> ["Aa", "Ee", "Ii", "Oo", "Uu"]
                                                    x5 - times 5 -> ["AAAAAaaaaa", "EEEEEeeeee", "IIIIIiiiii", "OOOOOooooo", "UUUUUuuuuu"]
                                                    Ƈ - filter keep if:
                                                    f - filter keep only -> those of X which have required vowels
                                                    - ...i.e. if S = "blah" then ["AAAAAaaaaa"]
                                                    ð ð€ - dyadic chain for €ach:
                                                    Øc - vowels -> "AEIOUaeiou"
                                                    , - pair e.g. ["AEIOUaeiou","AAAAAaaaaa"]
                                                    y - translate e.g. swap A for A, E for A, ...
                                                    Y - join with newlines





                                                    share|improve this answer















                                                    Jelly,  23 20 18  17 bytes



                                                    -2 Thanks to Erik the Outgolfer



                                                    ØcŒHZx5fƇðØc,yð€Y


                                                    To treat y as a vowel replace both cs with ys.



                                                    Try it online!



                                                    How?



                                                    ØcŒHZx5fƇðØc,yð€Y - Link: list of characters, S
                                                    Øc - vowels -> "AEIOUaeiou"
                                                    Ã…Â’H - split in half -> ["AEIOU", "aeiou"]
                                                    Z - transpose -> ["Aa", "Ee", "Ii", "Oo", "Uu"]
                                                    x5 - times 5 -> ["AAAAAaaaaa", "EEEEEeeeee", "IIIIIiiiii", "OOOOOooooo", "UUUUUuuuuu"]
                                                    Ƈ - filter keep if:
                                                    f - filter keep only -> those of X which have required vowels
                                                    - ...i.e. if S = "blah" then ["AAAAAaaaaa"]
                                                    ð ð€ - dyadic chain for €ach:
                                                    Øc - vowels -> "AEIOUaeiou"
                                                    , - pair e.g. ["AEIOUaeiou","AAAAAaaaaa"]
                                                    y - translate e.g. swap A for A, E for A, ...
                                                    Y - join with newlines






                                                    share|improve this answer














                                                    share|improve this answer



                                                    share|improve this answer








                                                    edited Sep 2 at 20:29

























                                                    answered Sep 2 at 19:29









                                                    Jonathan Allan

                                                    48.5k534159




                                                    48.5k534159











                                                    • 18 bytes (trivial) (ż/ on a pair is Z, two dyads in a row where the left one is unpaired in a monad have the argument in-between implicitly)
                                                      – Erik the Outgolfer
                                                      Sep 2 at 19:40











                                                    • Thanks (Z >_<), not sure what was going on with my TIO session, but removing the redundant ð wasn't working; restart fixed.
                                                      – Jonathan Allan
                                                      Sep 2 at 19:54











                                                    • TBH, I actually fixed x€ → x too, but you ninja'd me. :P
                                                      – Erik the Outgolfer
                                                      Sep 2 at 19:55
















                                                    • 18 bytes (trivial) (ż/ on a pair is Z, two dyads in a row where the left one is unpaired in a monad have the argument in-between implicitly)
                                                      – Erik the Outgolfer
                                                      Sep 2 at 19:40











                                                    • Thanks (Z >_<), not sure what was going on with my TIO session, but removing the redundant ð wasn't working; restart fixed.
                                                      – Jonathan Allan
                                                      Sep 2 at 19:54











                                                    • TBH, I actually fixed x€ → x too, but you ninja'd me. :P
                                                      – Erik the Outgolfer
                                                      Sep 2 at 19:55















                                                    18 bytes (trivial) (ż/ on a pair is Z, two dyads in a row where the left one is unpaired in a monad have the argument in-between implicitly)
                                                    – Erik the Outgolfer
                                                    Sep 2 at 19:40





                                                    18 bytes (trivial) (ż/ on a pair is Z, two dyads in a row where the left one is unpaired in a monad have the argument in-between implicitly)
                                                    – Erik the Outgolfer
                                                    Sep 2 at 19:40













                                                    Thanks (Z >_<), not sure what was going on with my TIO session, but removing the redundant ð wasn't working; restart fixed.
                                                    – Jonathan Allan
                                                    Sep 2 at 19:54





                                                    Thanks (Z >_<), not sure what was going on with my TIO session, but removing the redundant ð wasn't working; restart fixed.
                                                    – Jonathan Allan
                                                    Sep 2 at 19:54













                                                    TBH, I actually fixed x€ → x too, but you ninja'd me. :P
                                                    – Erik the Outgolfer
                                                    Sep 2 at 19:55




                                                    TBH, I actually fixed x€ → x too, but you ninja'd me. :P
                                                    – Erik the Outgolfer
                                                    Sep 2 at 19:55










                                                    up vote
                                                    3
                                                    down vote














                                                    Red, 229 bytes



                                                    Taking y for a non-vowel



                                                    func[s][v: charset"aoeiu"w: charset"AOEIU"p: copy""parse s[any[[copy c[v | w](if not find p c[append p c lowercase c
                                                    parse s[any[[copy n to[v | w | end]](prin n)opt[v(prin c)|[w(prin uppercase copy c)]| skip]]]print""])]| skip]]]


                                                    Try it online!



                                                    Slightly more readable:



                                                    f: func [ s ] [
                                                    v: charset "aoeiu"
                                                    w: charset "AOEIU"
                                                    p: copy ""
                                                    parse s[
                                                    any [
                                                    [ copy c [ v | w ]
                                                    ( if not find p c [
                                                    append p c
                                                    lowercase c
                                                    parse s [
                                                    any [
                                                    [ copy n to [ v | w | end ] ]
                                                    ( prin n )
                                                    opt [ v ( prin c )
                                                    | [ w ( prin uppercase copy c ) ]
                                                    | skip
                                                    ]
                                                    ]
                                                    ]
                                                    print ""
                                                    ] )
                                                    ]
                                                    | skip
                                                    ]
                                                    ]
                                                    ]





                                                    share|improve this answer


























                                                      up vote
                                                      3
                                                      down vote














                                                      Red, 229 bytes



                                                      Taking y for a non-vowel



                                                      func[s][v: charset"aoeiu"w: charset"AOEIU"p: copy""parse s[any[[copy c[v | w](if not find p c[append p c lowercase c
                                                      parse s[any[[copy n to[v | w | end]](prin n)opt[v(prin c)|[w(prin uppercase copy c)]| skip]]]print""])]| skip]]]


                                                      Try it online!



                                                      Slightly more readable:



                                                      f: func [ s ] [
                                                      v: charset "aoeiu"
                                                      w: charset "AOEIU"
                                                      p: copy ""
                                                      parse s[
                                                      any [
                                                      [ copy c [ v | w ]
                                                      ( if not find p c [
                                                      append p c
                                                      lowercase c
                                                      parse s [
                                                      any [
                                                      [ copy n to [ v | w | end ] ]
                                                      ( prin n )
                                                      opt [ v ( prin c )
                                                      | [ w ( prin uppercase copy c ) ]
                                                      | skip
                                                      ]
                                                      ]
                                                      ]
                                                      print ""
                                                      ] )
                                                      ]
                                                      | skip
                                                      ]
                                                      ]
                                                      ]





                                                      share|improve this answer
























                                                        up vote
                                                        3
                                                        down vote










                                                        up vote
                                                        3
                                                        down vote










                                                        Red, 229 bytes



                                                        Taking y for a non-vowel



                                                        func[s][v: charset"aoeiu"w: charset"AOEIU"p: copy""parse s[any[[copy c[v | w](if not find p c[append p c lowercase c
                                                        parse s[any[[copy n to[v | w | end]](prin n)opt[v(prin c)|[w(prin uppercase copy c)]| skip]]]print""])]| skip]]]


                                                        Try it online!



                                                        Slightly more readable:



                                                        f: func [ s ] [
                                                        v: charset "aoeiu"
                                                        w: charset "AOEIU"
                                                        p: copy ""
                                                        parse s[
                                                        any [
                                                        [ copy c [ v | w ]
                                                        ( if not find p c [
                                                        append p c
                                                        lowercase c
                                                        parse s [
                                                        any [
                                                        [ copy n to [ v | w | end ] ]
                                                        ( prin n )
                                                        opt [ v ( prin c )
                                                        | [ w ( prin uppercase copy c ) ]
                                                        | skip
                                                        ]
                                                        ]
                                                        ]
                                                        print ""
                                                        ] )
                                                        ]
                                                        | skip
                                                        ]
                                                        ]
                                                        ]





                                                        share|improve this answer















                                                        Red, 229 bytes



                                                        Taking y for a non-vowel



                                                        func[s][v: charset"aoeiu"w: charset"AOEIU"p: copy""parse s[any[[copy c[v | w](if not find p c[append p c lowercase c
                                                        parse s[any[[copy n to[v | w | end]](prin n)opt[v(prin c)|[w(prin uppercase copy c)]| skip]]]print""])]| skip]]]


                                                        Try it online!



                                                        Slightly more readable:



                                                        f: func [ s ] [
                                                        v: charset "aoeiu"
                                                        w: charset "AOEIU"
                                                        p: copy ""
                                                        parse s[
                                                        any [
                                                        [ copy c [ v | w ]
                                                        ( if not find p c [
                                                        append p c
                                                        lowercase c
                                                        parse s [
                                                        any [
                                                        [ copy n to [ v | w | end ] ]
                                                        ( prin n )
                                                        opt [ v ( prin c )
                                                        | [ w ( prin uppercase copy c ) ]
                                                        | skip
                                                        ]
                                                        ]
                                                        ]
                                                        print ""
                                                        ] )
                                                        ]
                                                        | skip
                                                        ]
                                                        ]
                                                        ]






                                                        share|improve this answer














                                                        share|improve this answer



                                                        share|improve this answer








                                                        edited Sep 3 at 13:56

























                                                        answered Sep 3 at 13:48









                                                        Galen Ivanov

                                                        4,8471829




                                                        4,8471829




















                                                            up vote
                                                            3
                                                            down vote














                                                            R, 138, 129 bytes





                                                            function(x,U=utf8ToInt,a=U(V<-'aeiouAEIOU'))for(i in (which(a%in%U(x))-1)%%5)cat(chartr(V,intToUtf8(rep(a[i+c(1,6)],e=5)),x),'
                                                            ')


                                                            Try it online!




                                                            • y is not considered a vowel





                                                            share|improve this answer


























                                                              up vote
                                                              3
                                                              down vote














                                                              R, 138, 129 bytes





                                                              function(x,U=utf8ToInt,a=U(V<-'aeiouAEIOU'))for(i in (which(a%in%U(x))-1)%%5)cat(chartr(V,intToUtf8(rep(a[i+c(1,6)],e=5)),x),'
                                                              ')


                                                              Try it online!




                                                              • y is not considered a vowel





                                                              share|improve this answer
























                                                                up vote
                                                                3
                                                                down vote










                                                                up vote
                                                                3
                                                                down vote










                                                                R, 138, 129 bytes





                                                                function(x,U=utf8ToInt,a=U(V<-'aeiouAEIOU'))for(i in (which(a%in%U(x))-1)%%5)cat(chartr(V,intToUtf8(rep(a[i+c(1,6)],e=5)),x),'
                                                                ')


                                                                Try it online!




                                                                • y is not considered a vowel





                                                                share|improve this answer















                                                                R, 138, 129 bytes





                                                                function(x,U=utf8ToInt,a=U(V<-'aeiouAEIOU'))for(i in (which(a%in%U(x))-1)%%5)cat(chartr(V,intToUtf8(rep(a[i+c(1,6)],e=5)),x),'
                                                                ')


                                                                Try it online!




                                                                • y is not considered a vowel






                                                                share|improve this answer














                                                                share|improve this answer



                                                                share|improve this answer








                                                                edited Sep 4 at 9:04

























                                                                answered Sep 3 at 13:59









                                                                digEmAll

                                                                1,84147




                                                                1,84147




















                                                                    up vote
                                                                    2
                                                                    down vote













                                                                    Python, 129 119 112 bytes



                                                                    import re
                                                                    f=lambda s:'n'.join(r('[AEIOU]',v.upper(),r('[aeiou]',v,s))for v in'aeiou'if v in s.lower());r=re.sub


                                                                    Try it Online!



                                                                    Doesn't treat $y$ as vowel.



                                                                    -7 bytes thanks to @Mr.Xcoder






                                                                    share|improve this answer






















                                                                    • Glad to see you could get it working and golfed down a bit! Nice work
                                                                      – joH1
                                                                      Sep 2 at 20:34










                                                                    • @joH1 Thanks :)
                                                                      – DimChtz
                                                                      Sep 2 at 20:37










                                                                    • 112 bytes.
                                                                      – Mr. Xcoder
                                                                      Sep 2 at 21:53















                                                                    up vote
                                                                    2
                                                                    down vote













                                                                    Python, 129 119 112 bytes



                                                                    import re
                                                                    f=lambda s:'n'.join(r('[AEIOU]',v.upper(),r('[aeiou]',v,s))for v in'aeiou'if v in s.lower());r=re.sub


                                                                    Try it Online!



                                                                    Doesn't treat $y$ as vowel.



                                                                    -7 bytes thanks to @Mr.Xcoder






                                                                    share|improve this answer






















                                                                    • Glad to see you could get it working and golfed down a bit! Nice work
                                                                      – joH1
                                                                      Sep 2 at 20:34










                                                                    • @joH1 Thanks :)
                                                                      – DimChtz
                                                                      Sep 2 at 20:37










                                                                    • 112 bytes.
                                                                      – Mr. Xcoder
                                                                      Sep 2 at 21:53













                                                                    up vote
                                                                    2
                                                                    down vote










                                                                    up vote
                                                                    2
                                                                    down vote









                                                                    Python, 129 119 112 bytes



                                                                    import re
                                                                    f=lambda s:'n'.join(r('[AEIOU]',v.upper(),r('[aeiou]',v,s))for v in'aeiou'if v in s.lower());r=re.sub


                                                                    Try it Online!



                                                                    Doesn't treat $y$ as vowel.



                                                                    -7 bytes thanks to @Mr.Xcoder






                                                                    share|improve this answer














                                                                    Python, 129 119 112 bytes



                                                                    import re
                                                                    f=lambda s:'n'.join(r('[AEIOU]',v.upper(),r('[aeiou]',v,s))for v in'aeiou'if v in s.lower());r=re.sub


                                                                    Try it Online!



                                                                    Doesn't treat $y$ as vowel.



                                                                    -7 bytes thanks to @Mr.Xcoder







                                                                    share|improve this answer














                                                                    share|improve this answer



                                                                    share|improve this answer








                                                                    edited Sep 2 at 22:19

























                                                                    answered Sep 2 at 17:56









                                                                    DimChtz

                                                                    681111




                                                                    681111











                                                                    • Glad to see you could get it working and golfed down a bit! Nice work
                                                                      – joH1
                                                                      Sep 2 at 20:34










                                                                    • @joH1 Thanks :)
                                                                      – DimChtz
                                                                      Sep 2 at 20:37










                                                                    • 112 bytes.
                                                                      – Mr. Xcoder
                                                                      Sep 2 at 21:53

















                                                                    • Glad to see you could get it working and golfed down a bit! Nice work
                                                                      – joH1
                                                                      Sep 2 at 20:34










                                                                    • @joH1 Thanks :)
                                                                      – DimChtz
                                                                      Sep 2 at 20:37










                                                                    • 112 bytes.
                                                                      – Mr. Xcoder
                                                                      Sep 2 at 21:53
















                                                                    Glad to see you could get it working and golfed down a bit! Nice work
                                                                    – joH1
                                                                    Sep 2 at 20:34




                                                                    Glad to see you could get it working and golfed down a bit! Nice work
                                                                    – joH1
                                                                    Sep 2 at 20:34












                                                                    @joH1 Thanks :)
                                                                    – DimChtz
                                                                    Sep 2 at 20:37




                                                                    @joH1 Thanks :)
                                                                    – DimChtz
                                                                    Sep 2 at 20:37












                                                                    112 bytes.
                                                                    – Mr. Xcoder
                                                                    Sep 2 at 21:53





                                                                    112 bytes.
                                                                    – Mr. Xcoder
                                                                    Sep 2 at 21:53











                                                                    up vote
                                                                    2
                                                                    down vote














                                                                    JavaScript (Node.js), 99 bytes



                                                                    Treats $y$ as a consonant.





                                                                    s=>(g=F=>Buffer(s).map(c=>2130466>>c&c>64?F(c):c)+`
                                                                    `)(v=>g[v&=31]||(g[v]=S+=g(c=>c&96|v)),S='')&&S


                                                                    Try it online!



                                                                    Commented



                                                                    s => ( // s = input string
                                                                    g = F => // g = helper function taking a callback function F
                                                                    Buffer(s) // turn s into a Buffer
                                                                    .map(c => // for each ASCII code c in s:
                                                                    2130466 // 2130466 is a vowel bitmask: 1000001000001000100010
                                                                    // u o i e a
                                                                    >> c // the ECMAScript specification enforces that the shiftCount is
                                                                    // the result of masking out all but the least significant 5 bits
                                                                    & c > 64 // also make sure to ignore non-letter characters
                                                                    ? // if a vowel is identified:
                                                                    F(c) // invoke F with c
                                                                    : // else:
                                                                    c // just yield c
                                                                    ) + `n` // end of map(); coerce back to a string and append a newline
                                                                    )(v => // invoke g with a callback that takes v:
                                                                    g[v &= 31] || ( // unless this vowel has already been encountered:
                                                                    g[v] = // mark it as encountered
                                                                    S += // and append to the output string S
                                                                    g( // the result of another call to g:
                                                                    c => c & 96 | v // where vowels are replaced with v, using the original case
                                                                    ) // end of inner call to g
                                                                    ), //
                                                                    S = '' // start with S = ''
                                                                    ) && S // end of outer call to g; return S





                                                                    share|improve this answer


























                                                                      up vote
                                                                      2
                                                                      down vote














                                                                      JavaScript (Node.js), 99 bytes



                                                                      Treats $y$ as a consonant.





                                                                      s=>(g=F=>Buffer(s).map(c=>2130466>>c&c>64?F(c):c)+`
                                                                      `)(v=>g[v&=31]||(g[v]=S+=g(c=>c&96|v)),S='')&&S


                                                                      Try it online!



                                                                      Commented



                                                                      s => ( // s = input string
                                                                      g = F => // g = helper function taking a callback function F
                                                                      Buffer(s) // turn s into a Buffer
                                                                      .map(c => // for each ASCII code c in s:
                                                                      2130466 // 2130466 is a vowel bitmask: 1000001000001000100010
                                                                      // u o i e a
                                                                      >> c // the ECMAScript specification enforces that the shiftCount is
                                                                      // the result of masking out all but the least significant 5 bits
                                                                      & c > 64 // also make sure to ignore non-letter characters
                                                                      ? // if a vowel is identified:
                                                                      F(c) // invoke F with c
                                                                      : // else:
                                                                      c // just yield c
                                                                      ) + `n` // end of map(); coerce back to a string and append a newline
                                                                      )(v => // invoke g with a callback that takes v:
                                                                      g[v &= 31] || ( // unless this vowel has already been encountered:
                                                                      g[v] = // mark it as encountered
                                                                      S += // and append to the output string S
                                                                      g( // the result of another call to g:
                                                                      c => c & 96 | v // where vowels are replaced with v, using the original case
                                                                      ) // end of inner call to g
                                                                      ), //
                                                                      S = '' // start with S = ''
                                                                      ) && S // end of outer call to g; return S





                                                                      share|improve this answer
























                                                                        up vote
                                                                        2
                                                                        down vote










                                                                        up vote
                                                                        2
                                                                        down vote










                                                                        JavaScript (Node.js), 99 bytes



                                                                        Treats $y$ as a consonant.





                                                                        s=>(g=F=>Buffer(s).map(c=>2130466>>c&c>64?F(c):c)+`
                                                                        `)(v=>g[v&=31]||(g[v]=S+=g(c=>c&96|v)),S='')&&S


                                                                        Try it online!



                                                                        Commented



                                                                        s => ( // s = input string
                                                                        g = F => // g = helper function taking a callback function F
                                                                        Buffer(s) // turn s into a Buffer
                                                                        .map(c => // for each ASCII code c in s:
                                                                        2130466 // 2130466 is a vowel bitmask: 1000001000001000100010
                                                                        // u o i e a
                                                                        >> c // the ECMAScript specification enforces that the shiftCount is
                                                                        // the result of masking out all but the least significant 5 bits
                                                                        & c > 64 // also make sure to ignore non-letter characters
                                                                        ? // if a vowel is identified:
                                                                        F(c) // invoke F with c
                                                                        : // else:
                                                                        c // just yield c
                                                                        ) + `n` // end of map(); coerce back to a string and append a newline
                                                                        )(v => // invoke g with a callback that takes v:
                                                                        g[v &= 31] || ( // unless this vowel has already been encountered:
                                                                        g[v] = // mark it as encountered
                                                                        S += // and append to the output string S
                                                                        g( // the result of another call to g:
                                                                        c => c & 96 | v // where vowels are replaced with v, using the original case
                                                                        ) // end of inner call to g
                                                                        ), //
                                                                        S = '' // start with S = ''
                                                                        ) && S // end of outer call to g; return S





                                                                        share|improve this answer















                                                                        JavaScript (Node.js), 99 bytes



                                                                        Treats $y$ as a consonant.





                                                                        s=>(g=F=>Buffer(s).map(c=>2130466>>c&c>64?F(c):c)+`
                                                                        `)(v=>g[v&=31]||(g[v]=S+=g(c=>c&96|v)),S='')&&S


                                                                        Try it online!



                                                                        Commented



                                                                        s => ( // s = input string
                                                                        g = F => // g = helper function taking a callback function F
                                                                        Buffer(s) // turn s into a Buffer
                                                                        .map(c => // for each ASCII code c in s:
                                                                        2130466 // 2130466 is a vowel bitmask: 1000001000001000100010
                                                                        // u o i e a
                                                                        >> c // the ECMAScript specification enforces that the shiftCount is
                                                                        // the result of masking out all but the least significant 5 bits
                                                                        & c > 64 // also make sure to ignore non-letter characters
                                                                        ? // if a vowel is identified:
                                                                        F(c) // invoke F with c
                                                                        : // else:
                                                                        c // just yield c
                                                                        ) + `n` // end of map(); coerce back to a string and append a newline
                                                                        )(v => // invoke g with a callback that takes v:
                                                                        g[v &= 31] || ( // unless this vowel has already been encountered:
                                                                        g[v] = // mark it as encountered
                                                                        S += // and append to the output string S
                                                                        g( // the result of another call to g:
                                                                        c => c & 96 | v // where vowels are replaced with v, using the original case
                                                                        ) // end of inner call to g
                                                                        ), //
                                                                        S = '' // start with S = ''
                                                                        ) && S // end of outer call to g; return S






                                                                        share|improve this answer














                                                                        share|improve this answer



                                                                        share|improve this answer








                                                                        edited Sep 3 at 6:10

























                                                                        answered Sep 2 at 20:48









                                                                        Arnauld

                                                                        65k581274




                                                                        65k581274




















                                                                            up vote
                                                                            2
                                                                            down vote













                                                                            Java 10, 196 188 bytes





                                                                            s->var d=new int[99];for(var c:s.toUpperCase().replaceAll("[^AEIOU]","").toCharArray())if(d[c]++<1)System.out.println(s.replaceAll("[AEIOU]",c+"").replaceAll("[aeiou]",(char)(c+32)+""));


                                                                            -8 bytes thanks to @joH1.



                                                                            Without y as vowel to save bytes.



                                                                            Try it online.



                                                                            Explanation:



                                                                            s-> // Method with String parameter and no return-type
                                                                            var d=new int[99]; // Integer-array indicating which vowels we've already output
                                                                            for(var c:s.toUpperCase()// Convert the input to uppercase
                                                                            .replaceAll("[^AEIOU]","")
                                                                            // Remove all non-vowels
                                                                            .toCharArray())// Convert it to a character array)
                                                                            // And loop over those vowel-characters
                                                                            if(d[c]++ // Increase the vowel-count by 1
                                                                            <1) // And if it was 0 this iteration:
                                                                            System.out.println( // Print with trailing newline:
                                                                            s // The input,
                                                                            .replaceAll("[AEIOU]",c+"")
                                                                            // with every uppercase vowel replace with the current vowel
                                                                            .replaceAll("[aeiou]",(char)(c+32)+""));
                                                                            // and every lowercase vowel replaced as well





                                                                            share|improve this answer






















                                                                            • 188 bytes by inlining the variable v in the loop
                                                                              – joH1
                                                                              Sep 4 at 9:03










                                                                            • @joH1 Thanks, not sure how I missed that..
                                                                              – Kevin Cruijssen
                                                                              Sep 4 at 9:07














                                                                            up vote
                                                                            2
                                                                            down vote













                                                                            Java 10, 196 188 bytes





                                                                            s->var d=new int[99];for(var c:s.toUpperCase().replaceAll("[^AEIOU]","").toCharArray())if(d[c]++<1)System.out.println(s.replaceAll("[AEIOU]",c+"").replaceAll("[aeiou]",(char)(c+32)+""));


                                                                            -8 bytes thanks to @joH1.



                                                                            Without y as vowel to save bytes.



                                                                            Try it online.



                                                                            Explanation:



                                                                            s-> // Method with String parameter and no return-type
                                                                            var d=new int[99]; // Integer-array indicating which vowels we've already output
                                                                            for(var c:s.toUpperCase()// Convert the input to uppercase
                                                                            .replaceAll("[^AEIOU]","")
                                                                            // Remove all non-vowels
                                                                            .toCharArray())// Convert it to a character array)
                                                                            // And loop over those vowel-characters
                                                                            if(d[c]++ // Increase the vowel-count by 1
                                                                            <1) // And if it was 0 this iteration:
                                                                            System.out.println( // Print with trailing newline:
                                                                            s // The input,
                                                                            .replaceAll("[AEIOU]",c+"")
                                                                            // with every uppercase vowel replace with the current vowel
                                                                            .replaceAll("[aeiou]",(char)(c+32)+""));
                                                                            // and every lowercase vowel replaced as well





                                                                            share|improve this answer






















                                                                            • 188 bytes by inlining the variable v in the loop
                                                                              – joH1
                                                                              Sep 4 at 9:03










                                                                            • @joH1 Thanks, not sure how I missed that..
                                                                              – Kevin Cruijssen
                                                                              Sep 4 at 9:07












                                                                            up vote
                                                                            2
                                                                            down vote










                                                                            up vote
                                                                            2
                                                                            down vote









                                                                            Java 10, 196 188 bytes





                                                                            s->var d=new int[99];for(var c:s.toUpperCase().replaceAll("[^AEIOU]","").toCharArray())if(d[c]++<1)System.out.println(s.replaceAll("[AEIOU]",c+"").replaceAll("[aeiou]",(char)(c+32)+""));


                                                                            -8 bytes thanks to @joH1.



                                                                            Without y as vowel to save bytes.



                                                                            Try it online.



                                                                            Explanation:



                                                                            s-> // Method with String parameter and no return-type
                                                                            var d=new int[99]; // Integer-array indicating which vowels we've already output
                                                                            for(var c:s.toUpperCase()// Convert the input to uppercase
                                                                            .replaceAll("[^AEIOU]","")
                                                                            // Remove all non-vowels
                                                                            .toCharArray())// Convert it to a character array)
                                                                            // And loop over those vowel-characters
                                                                            if(d[c]++ // Increase the vowel-count by 1
                                                                            <1) // And if it was 0 this iteration:
                                                                            System.out.println( // Print with trailing newline:
                                                                            s // The input,
                                                                            .replaceAll("[AEIOU]",c+"")
                                                                            // with every uppercase vowel replace with the current vowel
                                                                            .replaceAll("[aeiou]",(char)(c+32)+""));
                                                                            // and every lowercase vowel replaced as well





                                                                            share|improve this answer














                                                                            Java 10, 196 188 bytes





                                                                            s->var d=new int[99];for(var c:s.toUpperCase().replaceAll("[^AEIOU]","").toCharArray())if(d[c]++<1)System.out.println(s.replaceAll("[AEIOU]",c+"").replaceAll("[aeiou]",(char)(c+32)+""));


                                                                            -8 bytes thanks to @joH1.



                                                                            Without y as vowel to save bytes.



                                                                            Try it online.



                                                                            Explanation:



                                                                            s-> // Method with String parameter and no return-type
                                                                            var d=new int[99]; // Integer-array indicating which vowels we've already output
                                                                            for(var c:s.toUpperCase()// Convert the input to uppercase
                                                                            .replaceAll("[^AEIOU]","")
                                                                            // Remove all non-vowels
                                                                            .toCharArray())// Convert it to a character array)
                                                                            // And loop over those vowel-characters
                                                                            if(d[c]++ // Increase the vowel-count by 1
                                                                            <1) // And if it was 0 this iteration:
                                                                            System.out.println( // Print with trailing newline:
                                                                            s // The input,
                                                                            .replaceAll("[AEIOU]",c+"")
                                                                            // with every uppercase vowel replace with the current vowel
                                                                            .replaceAll("[aeiou]",(char)(c+32)+""));
                                                                            // and every lowercase vowel replaced as well






                                                                            share|improve this answer














                                                                            share|improve this answer



                                                                            share|improve this answer








                                                                            edited Sep 4 at 9:07

























                                                                            answered Sep 3 at 9:45









                                                                            Kevin Cruijssen

                                                                            30.5k553167




                                                                            30.5k553167











                                                                            • 188 bytes by inlining the variable v in the loop
                                                                              – joH1
                                                                              Sep 4 at 9:03










                                                                            • @joH1 Thanks, not sure how I missed that..
                                                                              – Kevin Cruijssen
                                                                              Sep 4 at 9:07
















                                                                            • 188 bytes by inlining the variable v in the loop
                                                                              – joH1
                                                                              Sep 4 at 9:03










                                                                            • @joH1 Thanks, not sure how I missed that..
                                                                              – Kevin Cruijssen
                                                                              Sep 4 at 9:07















                                                                            188 bytes by inlining the variable v in the loop
                                                                            – joH1
                                                                            Sep 4 at 9:03




                                                                            188 bytes by inlining the variable v in the loop
                                                                            – joH1
                                                                            Sep 4 at 9:03












                                                                            @joH1 Thanks, not sure how I missed that..
                                                                            – Kevin Cruijssen
                                                                            Sep 4 at 9:07




                                                                            @joH1 Thanks, not sure how I missed that..
                                                                            – Kevin Cruijssen
                                                                            Sep 4 at 9:07










                                                                            up vote
                                                                            1
                                                                            down vote














                                                                            Python 2, 112 bytes





                                                                            s=input()
                                                                            V='aeiouAEIOU'
                                                                            for v in V:
                                                                            if v in s.lower():print''.join([c,[v.upper(),v][c>'Z']][c in V]for c in s)


                                                                            Try it online!



                                                                            Treats y as a consonant.






                                                                            share|improve this answer
























                                                                              up vote
                                                                              1
                                                                              down vote














                                                                              Python 2, 112 bytes





                                                                              s=input()
                                                                              V='aeiouAEIOU'
                                                                              for v in V:
                                                                              if v in s.lower():print''.join([c,[v.upper(),v][c>'Z']][c in V]for c in s)


                                                                              Try it online!



                                                                              Treats y as a consonant.






                                                                              share|improve this answer






















                                                                                up vote
                                                                                1
                                                                                down vote










                                                                                up vote
                                                                                1
                                                                                down vote










                                                                                Python 2, 112 bytes





                                                                                s=input()
                                                                                V='aeiouAEIOU'
                                                                                for v in V:
                                                                                if v in s.lower():print''.join([c,[v.upper(),v][c>'Z']][c in V]for c in s)


                                                                                Try it online!



                                                                                Treats y as a consonant.






                                                                                share|improve this answer













                                                                                Python 2, 112 bytes





                                                                                s=input()
                                                                                V='aeiouAEIOU'
                                                                                for v in V:
                                                                                if v in s.lower():print''.join([c,[v.upper(),v][c>'Z']][c in V]for c in s)


                                                                                Try it online!



                                                                                Treats y as a consonant.







                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered Sep 2 at 21:41









                                                                                Chas Brown

                                                                                4,2611319




                                                                                4,2611319




















                                                                                    up vote
                                                                                    1
                                                                                    down vote














                                                                                    Perl 6, 64 bytes





                                                                                    m:g:i/<[aeiou]>/».lc.unique».&$^v;say S:g:ii[<[aeiou]>]=$v


                                                                                    Try it online!






                                                                                    share|improve this answer
























                                                                                      up vote
                                                                                      1
                                                                                      down vote














                                                                                      Perl 6, 64 bytes





                                                                                      m:g:i/<[aeiou]>/».lc.unique».&$^v;say S:g:ii[<[aeiou]>]=$v


                                                                                      Try it online!






                                                                                      share|improve this answer






















                                                                                        up vote
                                                                                        1
                                                                                        down vote










                                                                                        up vote
                                                                                        1
                                                                                        down vote










                                                                                        Perl 6, 64 bytes





                                                                                        m:g:i/<[aeiou]>/».lc.unique».&$^v;say S:g:ii[<[aeiou]>]=$v


                                                                                        Try it online!






                                                                                        share|improve this answer













                                                                                        Perl 6, 64 bytes





                                                                                        m:g:i/<[aeiou]>/».lc.unique».&$^v;say S:g:ii[<[aeiou]>]=$v


                                                                                        Try it online!







                                                                                        share|improve this answer












                                                                                        share|improve this answer



                                                                                        share|improve this answer










                                                                                        answered Sep 3 at 10:33









                                                                                        nwellnhof

                                                                                        3,793715




                                                                                        3,793715




















                                                                                            up vote
                                                                                            1
                                                                                            down vote














                                                                                            Java (OpenJDK 8), 184 bytes



                                                                                            y is a vowel





                                                                                            s->s.chars().mapToObj(c->""+(char)(c>96?c:c+32)).filter("aeiouy"::contains).distinct().forEach(c->System.out.println(s.replaceAll("[aeiouy]",c).replaceAll("[AEIOUY]",c.toUpperCase())))


                                                                                            Try it online!






                                                                                            share|improve this answer


























                                                                                              up vote
                                                                                              1
                                                                                              down vote














                                                                                              Java (OpenJDK 8), 184 bytes



                                                                                              y is a vowel





                                                                                              s->s.chars().mapToObj(c->""+(char)(c>96?c:c+32)).filter("aeiouy"::contains).distinct().forEach(c->System.out.println(s.replaceAll("[aeiouy]",c).replaceAll("[AEIOUY]",c.toUpperCase())))


                                                                                              Try it online!






                                                                                              share|improve this answer
























                                                                                                up vote
                                                                                                1
                                                                                                down vote










                                                                                                up vote
                                                                                                1
                                                                                                down vote










                                                                                                Java (OpenJDK 8), 184 bytes



                                                                                                y is a vowel





                                                                                                s->s.chars().mapToObj(c->""+(char)(c>96?c:c+32)).filter("aeiouy"::contains).distinct().forEach(c->System.out.println(s.replaceAll("[aeiouy]",c).replaceAll("[AEIOUY]",c.toUpperCase())))


                                                                                                Try it online!






                                                                                                share|improve this answer















                                                                                                Java (OpenJDK 8), 184 bytes



                                                                                                y is a vowel





                                                                                                s->s.chars().mapToObj(c->""+(char)(c>96?c:c+32)).filter("aeiouy"::contains).distinct().forEach(c->System.out.println(s.replaceAll("[aeiouy]",c).replaceAll("[AEIOUY]",c.toUpperCase())))


                                                                                                Try it online!







                                                                                                share|improve this answer














                                                                                                share|improve this answer



                                                                                                share|improve this answer








                                                                                                edited Sep 4 at 15:26

























                                                                                                answered Sep 4 at 15:20









                                                                                                Roberto Graham

                                                                                                1,285210




                                                                                                1,285210



























                                                                                                     

                                                                                                    draft saved


                                                                                                    draft discarded















































                                                                                                     


                                                                                                    draft saved


                                                                                                    draft discarded














                                                                                                    StackExchange.ready(
                                                                                                    function ()
                                                                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f171588%2frepeat-a-rhyme-and-loop-on-the-vowels%23new-answer', 'question_page');

                                                                                                    );

                                                                                                    Post as a guest













































































                                                                                                    Popular posts from this blog

                                                                                                    Peggy Mitchell

                                                                                                    The Forum (Inglewood, California)

                                                                                                    Palaiologos