Flags Mashup Bot is a small Twitter bot that generates a new country name based on two random country names and tweets the result every couple of minutes.
Task
Your task is to replicate what the bot does by writing a script or a function based on the following criteria:
- The input is two country names in English as shown in this page. Country names contain upper or lowercase letters of the English alphabet, spaces or dashes, and there's a special case of
Côte d'Ivoire
. They are usually capitalised with the exception of prepositions and similar words. Examples:United States of America
,Portugal
,Côte d'Ivoire
,Guinea-Bissau
. The output is a single country name that is a mixture of the two inputs based on the following rules:
- If both names are single words you have to split each country name after a vowel randomly, then use the first half from the first country and the second half of the second country.
- Vowels are
a
,e
,i
,o
,u
, or their uppercase variants - After the split both parts should contain at least one letter. The first half will always contain the vowel it was split by. The second half doesn't need to contain vowels however.
- Example:
Poland
can be split by eitherPo/land
orPola/nd
- Example:
Algeria
can be split byA/lgeria
,Alge/ria
, orAlgeri/a
. HoweverAlgeria/
is not valid, as the second half doesn't contain any letters. - Example output: Mixing
Poland
andAlgeria
can be either of the following:Polgeria
,Poria
,Poa
,Polalgeria
,Polaria
orPolaa
- Vowels are
- If one of the country names are multiple words while the other is a single one, then you have to replace either the first word of the multi-word one, or the last word with the other dependent on whether the multi-word country name is the first or second.
- Example:
United States of America
andFrance
isUnited States of France
. - Example:
France
andUnited States of America
isFrance States of America
- Example:
- If both names are multi-word ones then you have to split both of them at one of the word boundaries and then join them together afterwards.
- Example:
United States of America
andTrinidad and Tobago
can beUnited and Tobago
,United States and Tobago
,United States of and Tobago
,United Tobago
,United States Tobago
, orUnited States of Tobago
- Example:
- Special case 1: countries containing dashes counts multi-word ones. If you split the name at the dash you have to use a dash in the output instead of a space
- Example:
United States of America
andGuinea-Bissau
can beUnited States of-Bissau
among others - Example:
Spain
andTimor-Leste
isSpain-Leste
- Example:
- Special case 2: If you enter the same country twice, you have to return
<country name> 2
.- Example:
United States of America
andUnited States of America
will returnUnited States of America 2
- Example:
Hungary
andHungary
will returnHungary 2
- Example:
- If both names are single words you have to split each country name after a vowel randomly, then use the first half from the first country and the second half of the second country.
Notes:
- Your submission should work for at least the countries as shown in this list
- It is okay if the result is the same as one of the input countries, e.g.
United States of America
andUnited Kingdom
can result inUnited Kingdom
Côte d'Ivoire
counts as two words:Côte
andd'Ivoire
.- There are no countries in the list that contain both spaces and dashes
- Vowels are
a
,e
,i
,o
,u
,A
,E
,I
,O
,U
- Standard loopholes, as usual, are prohibited
Examples with all valid answers for a specific pair:
Poland, Algeria
Polgeria, Poria, Poa, Polalgeria, Polaria, Polaa
Algeria, Poland
Aland, And, Algeland, Algend, Algeriland, Algerind
United States of America, France
United States of France
France, United States of America
France States of America
United States of America, Trinidad and Tobago
United and Tobago, United States and Tobago, United States of and Tobago, United Tobago, United States Tobago, United States of Tobago
Trinidad and Tobago, United States of America
Trinidad States of America, Trinidad of America, Trinidad America, Trinidad and States of America, Trinidad and of America, Trinidad and America
Hungary, Hungary
Hungary 2
United States of America, United States of America
United States of America 2
United States of America, Guinea-Bissau
United-Bissau, United States-Bissau, United States of-Bissau
Guinea-Bissau, United States of America
Guinea-States of America, Guinea-of America, Guinea-America
Timor-Leste, Spain
Timor-Spain
Spain, Timor-Leste
Spain-Leste
Côte d'Ivoire, Portugal
Côte Portugal
Portugal, Côte d'Ivoire
Portugal d'Ivoire
Côte d'Ivoire, Timor-Leste
Côte-Leste
Timor-Leste, Côte d'Ivoire
Timor-d`Ivoire
code-golf, so shortest code by byte count wins and will be accepted. Please include example a set of input & output with your submission