Ever fancied creating cool twitter hashtags such as #brexit or #brangelina? this golf is for you.
Write a program that accepts two strings A & B as input and merges them according to the following algorithm:
- let
n
be the number of vowels groups in A (e.g.britain
has 2 vowels groups :i
in position 3 andai
in position 5).- if n = 1 : truncate A starting at its first vowel group position (example:
bill
=>b
) - if n > 1 : truncate A starting at its
n-1
th vowel group position (example:programming
=>progr
,britain
=>br
)
- if n = 1 : truncate A starting at its first vowel group position (example:
- remove all consonants at the beginning of B (
jennifer
=>ennifer
) - concatenate the modified A & B
Vowels are aeiou
; consonants are bcdfghjklmnpqrstvwxyz
.
Input
You can assume the input strings are lowercase and contain at least one vowel and one consonant.
Examples
brad + angelina => brangelina
britain + exit => brexit
ben + jennifer => bennifer
brangelina + exit => brangelexit
bill + hillary => billary
angelina + brad => angelad
programming + puzzle => progruzzle
code + golf => colf
out + go => o
donald trump
. \$\endgroup\$Django + Angular = Djular
\$\endgroup\$