/**
 * This function takes in two lists of historical events and returns the common events 
 * that occurred in both lists.
 * 
 * @param eventsList1 List of historical events
 * @param eventsList2 List of historical events
 * @return List of common historical events
 * 
 * Example:
 * val eventsList1 = listOf("First World War", "Industrial Revolution", "Ancient Olympics")
 * val eventsList2 = listOf("Ancient Olympics", "Renaissance", "Industrial Revolution")
 * 
 * intersectionOfEvents(eventsList1, eventsList2)
 * Output: ['Ancient Olympics', 'Industrial Revolution']
 */
fun intersectionOfEvents(eventsList1: List<String>, eventsList2: List<String>): List<String> {

    val commonEvents = mutableListOf<String>()
    
    // Nested loop to compare each event from the first list with each event from the second list
    for (event1 in eventsList1) {
        for (event2 in eventsList2) {
            // Check if the events are common or not
            if (event1 == event2) {
                commonEvents.add(event1)
            }
        }
    }
    
    return commonEvents
}
/**
 * This function takes in two lists of historical events and returns the common events 
 * that occurred in both lists.
 * 
 * @param eventsList1 List of historical events
 * @param eventsList2 List of historical events
 * @return List of common historical events
 * 
 * Example:
 * val eventsList1 = listOf("First World War", "Industrial Revolution", "Ancient Olympics")
 * val eventsList2 = listOf("Ancient Olympics", "Renaissance", "Industrial Revolution")
 * 
 * intersectionOfEvents(eventsList1, eventsList2)
 * Output: ['Ancient Olympics', 'Industrial Revolution']
 */
fun intersectionOfEvents(eventsList1: List<String>, eventsList2: List<String>): List<String> {
/**
 * This function takes in two lists of historical events and returns the common events 
 * that occurred in both lists.
 * 
 * @param eventsList1 List of historical events
 * @param eventsList2 List of historical events
 * @return List of common historical events
 * 
 * Example:
 * val eventsList1 = listOf("First World War", "Industrial Revolution", "Ancient Olympics")
 * val eventsList2 = listOf("Ancient Olympics", "Renaissance", "Industrial Revolution")
 * 
 * intersectionOfEvents(eventsList1, eventsList2)
 * Output: ['Ancient Olympics', 'Industrial Revolution']
 */
fun intersectionOfEvents(eventsList1: List<String>, eventsList2: List<String>): List<String> {

    val commonEvents = mutableListOf<String>()
    
    // Nested loop to compare each event from the first list with each event from the second list
    for (event1 in eventsList1) {
        for (event2 in eventsList2) {
            // Check if the events are common or not
            if (event1 == event2) {
                commonEvents.add(event1)
            }
        }
    }
    
    return commonEvents
}