Skip to main content
edited body
Source Link
GammaFunction
  • 6.9k
  • 13
  • 23

Zsh, 41 bytes

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}

Try it online!

Normally ${param#pattern} is prefix removal, adding the (M) flag keeps the prefix instead.

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}
   ${      @[1,2]         }                 # first two args
   ${(M   )      #*[aeiou]}                 # match shortest stringprefix ending with a vowel
   ${( j::)               }                 # join the resulting words on empty string
                           ${3[1]}          # third param, first char
                                   ${4:2}   # fourth param, starting at third char

If the first two words can be given as a single space seperated argument (as in corona virus disease 2019), then one byte can be saved for 40 bytes:

<<<${(Mj::)${=1}#*[aeiou]}${2[1]}-${3:2}

Try it online!

Zsh, 41 bytes

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}

Try it online!

Normally ${param#pattern} is prefix removal, adding the (M) flag keeps the prefix instead.

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}
   ${      @[1,2]         }                 # first two args
   ${(M   )      #*[aeiou]}                 # match shortest string ending with a vowel
   ${( j::)               }                 # join the resulting words on empty string
                           ${3[1]}          # third param, first char
                                   ${4:2}   # fourth param, starting at third char

If the first two words can be given as a single space seperated argument (as in corona virus disease 2019), then one byte can be saved for 40 bytes:

<<<${(Mj::)${=1}#*[aeiou]}${2[1]}-${3:2}

Try it online!

Zsh, 41 bytes

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}

Try it online!

Normally ${param#pattern} is prefix removal, adding the (M) flag keeps the prefix instead.

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}
   ${      @[1,2]         }                 # first two args
   ${(M   )      #*[aeiou]}                 # match shortest prefix ending with a vowel
   ${( j::)               }                 # join the resulting words on empty string
                           ${3[1]}          # third param, first char
                                   ${4:2}   # fourth param, starting at third char

If the first two words can be given as a single space seperated argument (as in corona virus disease 2019), then one byte can be saved for 40 bytes:

<<<${(Mj::)${=1}#*[aeiou]}${2[1]}-${3:2}

Try it online!

added 430 characters in body
Source Link
GammaFunction
  • 6.9k
  • 13
  • 23

Zsh, 41 bytes

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}

Try it online!

Normally ${param#pattern} is prefix removal, adding the (M) flag keeps the prefix instead.

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}
   ${      @[1,2]         }                 # first two args
   ${(M   )      #*[aeiou]}                 # match shortest string ending with a vowel
   ${( j::)               }                 # join the resulting words on empty string
                           ${3[1]}          # third param, first char
                                   ${4:2}   # fourth param, starting at third char

If the first two words can be given as a single space seperated argument (as in corona virus disease 2019), then one byte can be saved for 40 bytes:

<<<${(Mj::)${=1}#*[aeiou]}${2[1]}-${3:2}

Try it online!

Zsh, 41 bytes

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}

Try it online!

Normally ${param#pattern} is prefix removal, adding the (M) flag keeps the prefix instead.

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}
   ${      @[1,2]         }                 # first two args
   ${(M   )      #*[aeiou]}                 # match shortest string ending with a vowel
   ${( j::)               }                 # join the resulting words on empty string
                           ${3[1]}          # third param, first char
                                   ${4:2}   # fourth param, starting at third char

Zsh, 41 bytes

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}

Try it online!

Normally ${param#pattern} is prefix removal, adding the (M) flag keeps the prefix instead.

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}
   ${      @[1,2]         }                 # first two args
   ${(M   )      #*[aeiou]}                 # match shortest string ending with a vowel
   ${( j::)               }                 # join the resulting words on empty string
                           ${3[1]}          # third param, first char
                                   ${4:2}   # fourth param, starting at third char

If the first two words can be given as a single space seperated argument (as in corona virus disease 2019), then one byte can be saved for 40 bytes:

<<<${(Mj::)${=1}#*[aeiou]}${2[1]}-${3:2}

Try it online!

Source Link
GammaFunction
  • 6.9k
  • 13
  • 23

Zsh, 41 bytes

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}

Try it online!

Normally ${param#pattern} is prefix removal, adding the (M) flag keeps the prefix instead.

<<<${(Mj::)@[1,2]#*[aeiou]}${3[1]}-${4:2}
   ${      @[1,2]         }                 # first two args
   ${(M   )      #*[aeiou]}                 # match shortest string ending with a vowel
   ${( j::)               }                 # join the resulting words on empty string
                           ${3[1]}          # third param, first char
                                   ${4:2}   # fourth param, starting at third char