/**
 * Given a list of words and a list of prefixes, return a list of words that have a prefix as specified in the prefixes list.
 * The function should use nested loops to find the matching words, and the while loop should be used to iterate through the strings.
 */
fun findMatchingWords(words: List<String>, prefixes: List<String>): List<String> {

    val matchingWords = mutableListOf<String>()  // Initialize an empty list to store the matching words

    var i = 0  // Counter variable for iterating through the words
    while (i < words.size) {
        var j = 0  // Counter variable for iterating through the prefixes
        while (j < prefixes.size) {
            if (words[i].startsWith(prefixes[j])) {
                matchingWords.add(words[i])  // Add the matching word to the list
            }
            j++  // Increment the prefix counter
        }
        i++  // Increment the word counter
    }

    return matchingWords
}
/**
 * Given a list of words and a list of prefixes, return a list of words that have a prefix as specified in the prefixes list.
 * The function should use nested loops to find the matching words, and the while loop should be used to iterate through the strings.
 */
fun findMatchingWords(words: List<String>, prefixes: List<String>): List<String> {
/**
 * Given a list of words and a list of prefixes, return a list of words that have a prefix as specified in the prefixes list.
 * The function should use nested loops to find the matching words, and the while loop should be used to iterate through the strings.
 */
fun findMatchingWords(words: List<String>, prefixes: List<String>): List<String> {

    val matchingWords = mutableListOf<String>()  // Initialize an empty list to store the matching words

    var i = 0  // Counter variable for iterating through the words
    while (i < words.size) {
        var j = 0  // Counter variable for iterating through the prefixes
        while (j < prefixes.size) {
            if (words[i].startsWith(prefixes[j])) {
                matchingWords.add(words[i])  // Add the matching word to the list
            }
            j++  // Increment the prefix counter
        }
        i++  // Increment the word counter
    }

    return matchingWords
}