/**
 * Given a list of colors and a list of corresponding positions, return a new list containing only the colors which have all their letters at an odd position.
 *
 * @param colors A list of strings representing colors.
 * @param positions A list of lists representing positions of each letter in the color strings.
 * @return A list of colors that satisfy the criteria.
 *
 * Example:
 * val colors = listOf("red", "green", "blue", "yellow")
 * val positions = listOf(listOf(0, 3, 1), listOf(0, 2, 4), listOf(1, 3, 0, 2), listOf(1, 3, 2, 4))
 * getMatchingColors(colors, positions) -> listOf("red", "blue")
 */
fun getMatchingColors(colors: List<String>, positions: List<List<Int>>): List<String> {

    val matchingColors = mutableListOf<String>()

    for ((color, position) in colors.zip(positions)) {
        var allOdd = true
        for (index in position) {
            if (index % 2 == 0) {
                allOdd = false
                break
            }
        }
        if (allOdd) {
            matchingColors.add(color)
        }
    }

    return matchingColors
}
/**
 * Given a list of colors and a list of corresponding positions, return a new list containing only the colors which have all their letters at an odd position.
 *
 * @param colors A list of strings representing colors.
 * @param positions A list of lists representing positions of each letter in the color strings.
 * @return A list of colors that satisfy the criteria.
 *
 * Example:
 * val colors = listOf("red", "green", "blue", "yellow")
 * val positions = listOf(listOf(0, 3, 1), listOf(0, 2, 4), listOf(1, 3, 0, 2), listOf(1, 3, 2, 4))
 * getMatchingColors(colors, positions) -> listOf("red", "blue")
 */
fun getMatchingColors(colors: List<String>, positions: List<List<Int>>): List<String> {
/**
 * Given a list of colors and a list of corresponding positions, return a new list containing only the colors which have all their letters at an odd position.
 *
 * @param colors A list of strings representing colors.
 * @param positions A list of lists representing positions of each letter in the color strings.
 * @return A list of colors that satisfy the criteria.
 *
 * Example:
 * val colors = listOf("red", "green", "blue", "yellow")
 * val positions = listOf(listOf(0, 3, 1), listOf(0, 2, 4), listOf(1, 3, 0, 2), listOf(1, 3, 2, 4))
 * getMatchingColors(colors, positions) -> listOf("red", "blue")
 */
fun getMatchingColors(colors: List<String>, positions: List<List<Int>>): List<String> {

    val matchingColors = mutableListOf<String>()

    for ((color, position) in colors.zip(positions)) {
        var allOdd = true
        for (index in position) {
            if (index % 2 == 0) {
                allOdd = false
                break
            }
        }
        if (allOdd) {
            matchingColors.add(color)
        }
    }

    return matchingColors
}