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

added expression
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

Japt, (削除) 3839 (削除ここまで) 3637 bytes

 ̧ò ®efQ="%y+" ?Z£XrQZg°T fQP PÃ ̧:ZÃ ̧ZÃc ̧

Test it online! Test it online!

Explanation

 ̧ ò ® efQ="%y+" ?Z£ XrQ Zg° T fQ P PÃ :ZÃ c ̧
UqS ò mZ{Zef"%y+" ?ZmXYZ{Xr"%y+"Zg++T f"%y+"P P} :Z} c qS
 Implicit: U = input string, such as "abc def ghi jkl mno"
UqS Split on spaces, splitting into words. ["abc","def","ghi","jkl","mno"]
ò Group into runs of two items. [["abc","def"],["ghi","jkl"],["mno"]]
mZ{ For each pair Z:
 Zef"%y+"? If not every item contains a run of vowels (%y = [AEIOUYaeiouy]),
 :Z return Z. [ ["ghi","jkl"] ]
 ZmXYZ{ Otherwise, for each item X in Z:
 Xr"%y+" Replace each run of vowels with
 Zg++T the item at the next index in Z, [["def","abc"] ["mno"]]
 f"%y+"P but only the first run of vowels. [["e", "a" ] ["o" ]]
 P Replace only for the first match. [["ebc","daf"] ["mno"]]
 }
} [["ebc","daf"],["ghi","jkl"],"mno"]]
c Flatten back into a single array. ["ebc","def","ghi","jkl","mno"]
qS Re-join on spaces. "ebc daf ghi jkl mno"
 Implicit: output result of last expression

Japt, (削除) 38 (削除ここまで) 36 bytes

 ̧ò ®efQ="%y+" ?Z£XrQZg°T fQP PÃ ̧:ZÃ ̧

Test it online!

Japt, (削除) 39 (削除ここまで) 37 bytes

 ̧ò ®efQ="%y+" ?Z£XrQZg°T fQP :ZÃc ̧

Test it online!

Explanation

 ̧ ò ® efQ="%y+" ?Z£ XrQ Zg° T fQ P PÃ :ZÃ c ̧
UqS ò mZ{Zef"%y+" ?ZmXYZ{Xr"%y+"Zg++T f"%y+"P P} :Z} c qS
 Implicit: U = input string, such as "abc def ghi jkl mno"
UqS Split on spaces, splitting into words. ["abc","def","ghi","jkl","mno"]
ò Group into runs of two items. [["abc","def"],["ghi","jkl"],["mno"]]
mZ{ For each pair Z:
 Zef"%y+"? If not every item contains a run of vowels (%y = [AEIOUYaeiouy]),
 :Z return Z. [ ["ghi","jkl"] ]
 ZmXYZ{ Otherwise, for each item X in Z:
 Xr"%y+" Replace each run of vowels with
 Zg++T the item at the next index in Z, [["def","abc"] ["mno"]]
 f"%y+"P but only the first run of vowels. [["e", "a" ] ["o" ]]
 P Replace only for the first match. [["ebc","daf"] ["mno"]]
 }
} [["ebc","daf"],["ghi","jkl"],"mno"]]
c Flatten back into a single array. ["ebc","def","ghi","jkl","mno"]
qS Re-join on spaces. "ebc daf ghi jkl mno"
 Implicit: output result of last expression
golfed 2 bytes
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

Japt, 38(削除) 38 (削除ここまで) 36 bytes

They said it would be ugly, but I didn't listen... and it was:

 ̧ò ®ZefQ="%y+"®efQ="%y+" ?Z£XrQZg°T fQ gfQP PÃ ̧:ZÃ ̧

Test it online! Test it online!

Japt, 38 bytes

They said it would be ugly, but I didn't listen... and it was:

 ̧ò ®ZefQ="%y+" ?Z£XrQZg°T fQ g PÃ ̧:ZÃ ̧

Test it online!

Japt, (削除) 38 (削除ここまで) 36 bytes

They said it would be ugly, but I didn't listen... and it was:

 ̧ò ®efQ="%y+" ?Z£XrQZg°T fQP PÃ ̧:ZÃ ̧

Test it online!

Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

Japt, 38 bytes

They said it would be ugly, but I didn't listen... and it was:

 ̧ò ®ZefQ="%y+" ?Z£XrQZg°T fQ g PÃ ̧:ZÃ ̧

Test it online!

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