/**
 * This exercise is about finding the year in which a significant historical event occurred.
 */
fun findYear() {

    // Get the user's input
    print("Enter a historical event to find the year it occurred: ")
    val userInput = readLine()

    // Convert the user's input to lowercase for case-insensitive comparison
    val userEvent = userInput?.toLowerCase()

    // Initialize variables for the historical events and their corresponding years
    val events = listOf("fall of the Roman Empire", "discovery of America", "Declaration of Independence",
                        "World War I", "Moon landing")
    val years = listOf(476, 1492, 1776, 1914, 1969)

    // Iterate over the events list using a for loop
    for (i in events.indices) {
        val event = events[i]
        val year = years[i]

        // Check if the user's event matches the current event in the loop
        if (event.toLowerCase() == userEvent) {
            println("The year when $event occurred is $year")
            return
        }
    }

    // If no match is found, print an error message
    println("Sorry, we couldn't find the year for the event.")
}
/**
 * This exercise is about finding the year in which a significant historical event occurred.
 */
fun findYear() {
/**
 * This exercise is about finding the year in which a significant historical event occurred.
 */
fun findYear() {

    // Get the user's input
    print("Enter a historical event to find the year it occurred: ")
    val userInput = readLine()

    // Convert the user's input to lowercase for case-insensitive comparison
    val userEvent = userInput?.toLowerCase()

    // Initialize variables for the historical events and their corresponding years
    val events = listOf("fall of the Roman Empire", "discovery of America", "Declaration of Independence",
                        "World War I", "Moon landing")
    val years = listOf(476, 1492, 1776, 1914, 1969)

    // Iterate over the events list using a for loop
    for (i in events.indices) {
        val event = events[i]
        val year = years[i]

        // Check if the user's event matches the current event in the loop
        if (event.toLowerCase() == userEvent) {
            println("The year when $event occurred is $year")
            return
        }
    }

    // If no match is found, print an error message
    println("Sorry, we couldn't find the year for the event.")
}