Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Post Undeleted by Kamil Drakari
Updated to match the requirements
Source Link
Kamil Drakari
  • 4.4k
  • 12
  • 21

Japt, 1518 bytes

®ou qÃòqÃov
ò mq'_ q-

Try it Try it

Input as an array of character arrays.

Explanation:

®ou qÃòqÃov mq'_ q-
® Ã # For each word in the input:
 ou # For eachConvert characterthe array:last letter to uppercase
 ou q # Join to a #string
 Uppercase o # For the last characterword:
 q v # Convert it to lowercase
 # Join to a string
 # Save as U
ò mq'_ q- 
ò  # Cut U into pairs of words
 m # For each pair:
 q'_ # Join to a single string with "_" in between
 q- # Join all those strings with "-" between

I feel like there's room for improvement, but unfortunately ò doesn't have an overload for "cut into pairs, then reduce each pair".

Japt, 15 bytes

®ou qÃò mq'_ q-

Try it

Input as an array of character arrays.

Explanation:

®ou qÃò mq'_ q-
® Ã # For each character array:
 ou # Uppercase the last character
 q # Join to a string
 ò # Cut into pairs of words
 m # For each pair:
 q'_ # Join to a single string with "_" in between
 q- # Join all those strings with "-" between

I feel like there's room for improvement, but unfortunately ò doesn't have an overload for "cut into pairs, then reduce each pair".

Japt, 18 bytes

®ou qÃov
ò mq'_ q-

Try it

Input as an array of character arrays.

Explanation:

®ou qÃov 
® Ã # For each word in the input:
 ou # Convert the last letter to uppercase
 q # Join to a string
 o # For the last word:
 v # Convert it to lowercase
 # Save as U
ò mq'_ q- 
ò  # Cut U into pairs of words
 m # For each pair:
 q'_ # Join to a single string with "_" in between
 q- # Join all those strings with "-" between
Post Deleted by Kamil Drakari
Source Link
Kamil Drakari
  • 4.4k
  • 12
  • 21

Japt, 15 bytes

®ou qÃò mq'_ q-

Try it

Input as an array of character arrays.

Explanation:

®ou qÃò mq'_ q-
® Ã # For each character array:
 ou # Uppercase the last character
 q # Join to a string
 ò # Cut into pairs of words
 m # For each pair:
 q'_ # Join to a single string with "_" in between
 q- # Join all those strings with "-" between

I feel like there's room for improvement, but unfortunately ò doesn't have an overload for "cut into pairs, then reduce each pair".

AltStyle によって変換されたページ (->オリジナル) /