#C13577. Unique Combinations Excluding Odd-Vowel Pairs
Unique Combinations Excluding Odd-Vowel Pairs
Unique Combinations Excluding Odd-Vowel Pairs
You are given two lists:
- A list of integers.
- A list of single lowercase letters.
Your task is to generate all possible combinations (pairs) \((x, y)\) such that \(x\) is taken from the first list and \(y\) from the second list, with the restriction that if \(x\) is an odd number and \(y\) is a vowel (i.e. one of \(\{a,e,i,o,u\}\)), then that pair should be excluded.
Note: The order of the output pairs should follow the order of appearance: for every element in the first list in order, check every element in the second list in order.
inputFormat
The input is read from standard input and has the following format:
- An integer
n
on the first line, the number of elements in the first list. - A line with
n
space-separated integers representing the first list. - An integer
m
on the next line, the number of elements in the second list. - A line with
m
space-separated lowercase letters representing the second list.
For example:
3 1 2 3 3 a b c
outputFormat
For each valid combination that does not violate the condition (i.e. when x
is odd and y
is a vowel, skip that pair), output a line with two values separated by a space: the integer and the letter.
If there are no valid pairs, output nothing.
For instance, for the input above, the output should be:
1 b 1 c 2 a 2 b 2 c 3 b 3 c## sample
3
1 2 3
3
a b c
1 b
1 c
2 a
2 b
2 c
3 b
3 c
</p>