Skip to main content
deleted 777 characters in body
Source Link
Kevin Cruijssen
  • 136.3k
  • 14
  • 155
  • 394

05AB1E, 2828 13 bytes

žMSkþß©di®_i1ì}.γžMÃ}¦J…shmìžNSÛ©ai®…shmì 

Try it onlineTry it online or verify all test casesverify all test cases.

Explanation:

žMS # Push a list of vowels: ["a","e","i","o","u"] k žNSÛ # Pop and getTrim theall firstleading indicesconsonants of those vowels in the  # (implicit) string (or -1 if the vowel isn't present in the  # input-string) þ # Remove all those -1s ß # Push the minimum remaining index, or "" if none are left   ©  # Store this new string in variable `®` (without popping)   di  ai # Pop, and if it's a (non-negative) integer: ®_i  } # If `®` isany equalletters toare 0left (thus the input starts with a vowel): 1ì # Prepend a "1" in front of the (implicit) input-string .γ  # Group the (potentially modified) input-string by: žMÃ #  Keeping vowelscontains    # After thea group-byvowel): remove the first item   ® J # Join the other parts back to aPush string  `®` again  …shmì # # And prependPrepend "smh""shm"   # (afterimplicitly whichprint it is output implicitly as result)   # (implicit else)   # (implicitly output the implicit input-string instead) 

05AB1E, 28 bytes

žMSkþß©di®_i1ì}.γžMÃ}¦J…shmì 

Try it online or verify all test cases.

Explanation:

žMS # Push a list of vowels: ["a","e","i","o","u"] k  # Pop and get the first indices of those vowels in the  # (implicit) string (or -1 if the vowel isn't present in the  # input-string) þ # Remove all those -1s ß # Push the minimum remaining index, or "" if none are left   ©  # Store this in variable `®` (without popping)   di  # Pop, and if it's a (non-negative) integer: ®_i  } # If `®` is equal to 0 (thus the input starts with a vowel): 1ì # Prepend a "1" in front of the (implicit) input-string .γ  # Group the (potentially modified) input-string by: žMÃ #  Keeping vowels    # After the group-by: remove the first item   J # Join the other parts back to a string  …shmì # And prepend "smh"   # (after which it is output implicitly as result)   # (implicit else)   # (implicitly output the implicit input-string instead) 

05AB1E, 28 13 bytes

žNSÛ©ai®…shmì 

Try it online or verify all test cases.

Explanation:

žNSÛ # Trim all leading consonants of the (implicit) input-string © # Store this new string in variable `®` (without popping) ai # Pop, and if any letters are left (thus the input-string contains # a vowel): ® # Push string `®` again  …shmì # Prepend "shm" # (implicitly print it as result) # (implicit else) # (implicitly output the implicit input-string) 
deleted 10 characters in body
Source Link
Kevin Cruijssen
  • 136.3k
  • 14
  • 155
  • 394

05AB1E, 29 28 bytes

žMSkþß©di®_i1ì}.γžMÃ}¦J…shmì 

Try it online or verify all test casesverify all test cases.

Explanation:

žMS # Push a list of vowels: ["a","e","i","o","u"] k # Pop and get the first indices of those vowels in the # (implicit) string (or -1 if the vowel isn't present in the # input-string) þ # Remove all those -1s ß # Push the minimum remaining index, or "" if none are left © # Store this in variable `®` (without popping) di # Pop, and if it's a (non-negative) integer: ®_i } # If `®` is equal to 0 (thus the input starts with a vowel): 1ì # Prepend a "1" in front of the (implicit) input-string .γ # Group the (potentially modified) input-string by: žMÃ # KeepKeeping vowels }¦ # After the group-by: remove the first item J # Join the other parts back to a string …shmì # And prepend "smh" # (after which it is output implicitly as result) # (implicit else) # (implicitly output the implicit input-string instead) 

05AB1E, 29 28 bytes

žMSkþß©di®_i1ì}.γžMÃ}¦J…shmì 

Try it online or verify all test cases.

Explanation:

žMS # Push a list of vowels: ["a","e","i","o","u"] k # Pop and get the first indices of those vowels in the # (implicit) string (or -1 if the vowel isn't present in the # input-string) þ # Remove all those -1s ß # Push the minimum remaining index, or "" if none are left © # Store this in variable `®` (without popping) di # Pop, and if it's a (non-negative) integer: ®_i } # If `®` is equal to 0: 1ì # Prepend a "1" in front of the (implicit) input-string .γ # Group the (potentially modified) input-string by: žMÃ # Keep vowels }¦ # After the group-by: remove the first item J # Join the other parts back to a string …shmì # And prepend "smh" # (after which it is output implicitly as result) # (implicit else) # (implicitly output the implicit input-string instead) 

05AB1E, 28 bytes

žMSkþß©di®_i1ì}.γžMÃ}¦J…shmì 

Try it online or verify all test cases.

Explanation:

žMS # Push a list of vowels: ["a","e","i","o","u"] k # Pop and get the first indices of those vowels in the # (implicit) string (or -1 if the vowel isn't present in the # input-string) þ # Remove all those -1s ß # Push the minimum remaining index, or "" if none are left © # Store this in variable `®` (without popping) di # Pop, and if it's a (non-negative) integer: ®_i } # If `®` is equal to 0 (thus the input starts with a vowel): 1ì # Prepend a "1" in front of the (implicit) input-string .γ # Group the (potentially modified) input-string by: žMÃ # Keeping vowels }¦ # After the group-by: remove the first item J # Join the other parts back to a string …shmì # And prepend "smh" # (after which it is output implicitly as result) # (implicit else) # (implicitly output the implicit input-string instead) 
Source Link
Kevin Cruijssen
  • 136.3k
  • 14
  • 155
  • 394

05AB1E, 29 28 bytes

žMSkþß©di®_i1ì}.γžMÃ}¦J…shmì 

Try it online or verify all test cases.

Explanation:

žMS # Push a list of vowels: ["a","e","i","o","u"] k # Pop and get the first indices of those vowels in the # (implicit) string (or -1 if the vowel isn't present in the # input-string) þ # Remove all those -1s ß # Push the minimum remaining index, or "" if none are left © # Store this in variable `®` (without popping) di # Pop, and if it's a (non-negative) integer: ®_i } # If `®` is equal to 0: 1ì # Prepend a "1" in front of the (implicit) input-string .γ # Group the (potentially modified) input-string by: žMÃ # Keep vowels }¦ # After the group-by: remove the first item J # Join the other parts back to a string …shmì # And prepend "smh" # (after which it is output implicitly as result) # (implicit else) # (implicitly output the implicit input-string instead)