Vyxal, 20 bytes
⌈ṫ$ƛṫ⇧J;p ̈2∷‛_-iJ;ṅṪ
ƛṫ⇧J; could also be (⇧uvV, and ̈2∷‛_-iJ; could also be ‡1-ẇ‡\_JẆ.
How?
⌈ṫ$ƛṫ⇧J;p ̈2∷‛_-iJ;ṅṪ
⌈ # Split on spaces
ṫ # Tail extract; push a[:-1] and a[-1]
$ # Swap
ƛ # For each:
ṫ # Tail extract; push a[:-1] and a[-1]
⇧ # Uppercase
J # Join together again
; # Close map lambda
p # Append the last word again
̈2 # Map over this list, pushing both item and (0-based) index:
∷ # Modulo the index by 2
‛_-i # Index that into the string "_-"
J # Append that to the word
; # Close mapping lambda
ṅ # Join this list together
Ṫ # Remove the last character
naffetS
- 13.1k
- 2
- 22
- 54