Japt, (削除) 3839 (削除ここまで) 3637 bytes
̧ò ®efQ="%y+" ?Z£XrQZg°T fQP PÃ ̧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, (削除) 39 (削除ここまで) 37 bytes
̧ò ®efQ="%y+" ?Z£XrQZg°T fQP PÃ:ZÃc ̧
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(削除) 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Ã ̧
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Ã ̧