/**
 * Given a list of strings (lst) and a pattern, return the indices of elements in 
 * the list that contain the given pattern.
 *
 * Example:
 * lst = ['apple', 'banana', 'grape', 'banana', 'apple']
 * pattern = 'an'
 * output = [1, 3]
 *
 * @param lst a list of strings (length <= 1000)
 * @param pattern a string
 * @return A list of integers representing the indices of elements that contain the pattern.
 */
fun findPattern(lst: List<String>, pattern: String): List<Int> {

    val indexes = mutableListOf<Int>()

    // Iterate over each element of the list
    for ((index, elem) in lst.withIndex()) {
        // Check if the pattern is in the element
        if (pattern in elem) {
            indexes.add(index)
        }
    }

    return indexes
}
/**
 * Given a list of strings (lst) and a pattern, return the indices of elements in 
 * the list that contain the given pattern.
 *
 * Example:
 * lst = ['apple', 'banana', 'grape', 'banana', 'apple']
 * pattern = 'an'
 * output = [1, 3]
 *
 * @param lst a list of strings (length <= 1000)
 * @param pattern a string
 * @return A list of integers representing the indices of elements that contain the pattern.
 */
fun findPattern(lst: List<String>, pattern: String): List<Int> {
/**
 * Given a list of strings (lst) and a pattern, return the indices of elements in 
 * the list that contain the given pattern.
 *
 * Example:
 * lst = ['apple', 'banana', 'grape', 'banana', 'apple']
 * pattern = 'an'
 * output = [1, 3]
 *
 * @param lst a list of strings (length <= 1000)
 * @param pattern a string
 * @return A list of integers representing the indices of elements that contain the pattern.
 */
fun findPattern(lst: List<String>, pattern: String): List<Int> {

    val indexes = mutableListOf<Int>()

    // Iterate over each element of the list
    for ((index, elem) in lst.withIndex()) {
        // Check if the pattern is in the element
        if (pattern in elem) {
            indexes.add(index)
        }
    }

    return indexes
}