/**
 * This function takes a list of stars and a list of constellations as input and returns a list of stars that are
 * present in at least one of the constellations.
 *
 * @param starsList A list of stars' names.
 * @param constellationsList A list of constellations' names.
 * @return A list of star names that are present in at least one constellation.
 *
 * Examples:
 * findMatchingStars(listOf("Polaris", "Vega", "Antares"), listOf("Ursa Major", "Lyra", "Orion")) // Output: ['Polaris', 'Vega']
 * findMatchingStars(listOf("Betelgeuse", "Sirius", "Betelgeuse"), listOf("Orion", "Lyra", "Hydra")) // Output: ['Betelgeuse', 'Sirius']
 */
fun findMatchingStars(starsList: List<String>, constellationsList: List<String>): List<String> {

    val matchingStars = mutableListOf<String>()
    for (star in starsList) {
        for (constellation in constellationsList) {
            if (star in constellation) {
                matchingStars.add(star)
                break
            }
        }
    }
    return matchingStars
}
/**
 * This function takes a list of stars and a list of constellations as input and returns a list of stars that are
 * present in at least one of the constellations.
 *
 * @param starsList A list of stars' names.
 * @param constellationsList A list of constellations' names.
 * @return A list of star names that are present in at least one constellation.
 *
 * Examples:
 * findMatchingStars(listOf("Polaris", "Vega", "Antares"), listOf("Ursa Major", "Lyra", "Orion")) // Output: ['Polaris', 'Vega']
 * findMatchingStars(listOf("Betelgeuse", "Sirius", "Betelgeuse"), listOf("Orion", "Lyra", "Hydra")) // Output: ['Betelgeuse', 'Sirius']
 */
fun findMatchingStars(starsList: List<String>, constellationsList: List<String>): List<String> {
/**
 * This function takes a list of stars and a list of constellations as input and returns a list of stars that are
 * present in at least one of the constellations.
 *
 * @param starsList A list of stars' names.
 * @param constellationsList A list of constellations' names.
 * @return A list of star names that are present in at least one constellation.
 *
 * Examples:
 * findMatchingStars(listOf("Polaris", "Vega", "Antares"), listOf("Ursa Major", "Lyra", "Orion")) // Output: ['Polaris', 'Vega']
 * findMatchingStars(listOf("Betelgeuse", "Sirius", "Betelgeuse"), listOf("Orion", "Lyra", "Hydra")) // Output: ['Betelgeuse', 'Sirius']
 */
fun findMatchingStars(starsList: List<String>, constellationsList: List<String>): List<String> {

    val matchingStars = mutableListOf<String>()
    for (star in starsList) {
        for (constellation in constellationsList) {
            if (star in constellation) {
                matchingStars.add(star)
                break
            }
        }
    }
    return matchingStars
}