/**
 * This function takes in two dictionaries and returns a list of common keys between them.
 *
 * @param dict1 The first dictionary to be compared.
 * @param dict2 The second dictionary to be compared.
 * @return A list of common keys between the two dictionaries.
 */
fun findCommonKeys(dict1: Map<String, Int>, dict2: Map<String, Int>): List<String> {

    val commonKeys = mutableListOf<String>()
    while (true) {
        // TODO: Get the user input for finding common keys
        print("Enter a key (or 'q' to quit): ")
        val userInput = readLine() ?: ""
        
        // TODO: Add code to break the loop when the user enters 'q'
        if (userInput == "q") {
            break
        }
        
        // TODO: Add code to check if the key is present in both dictionaries and add it to commonKeys list
        if (userInput in dict1 && userInput in dict2) {
            commonKeys.add(userInput)
        }
    }
    
    return commonKeys
}

// Example usage
val dictionary1 = mapOf(
    "apple" to 1,
    "banana" to 2,
    "orange" to 3
)

val dictionary2 = mapOf(
    "banana" to 4,
    "grape" to 5,
    "orange" to 6
)
/**
 * This function takes in two dictionaries and returns a list of common keys between them.
 *
 * @param dict1 The first dictionary to be compared.
 * @param dict2 The second dictionary to be compared.
 * @return A list of common keys between the two dictionaries.
 */
fun findCommonKeys(dict1: Map<String, Int>, dict2: Map<String, Int>): List<String> {
/**
 * This function takes in two dictionaries and returns a list of common keys between them.
 *
 * @param dict1 The first dictionary to be compared.
 * @param dict2 The second dictionary to be compared.
 * @return A list of common keys between the two dictionaries.
 */
fun findCommonKeys(dict1: Map<String, Int>, dict2: Map<String, Int>): List<String> {

    val commonKeys = mutableListOf<String>()
    while (true) {
        // TODO: Get the user input for finding common keys
        print("Enter a key (or 'q' to quit): ")
        val userInput = readLine() ?: ""
        
        // TODO: Add code to break the loop when the user enters 'q'
        if (userInput == "q") {
            break
        }
        
        // TODO: Add code to check if the key is present in both dictionaries and add it to commonKeys list
        if (userInput in dict1 && userInput in dict2) {
            commonKeys.add(userInput)
        }
    }
    
    return commonKeys
}

// Example usage
val dictionary1 = mapOf(
    "apple" to 1,
    "banana" to 2,
    "orange" to 3
)

val dictionary2 = mapOf(
    "banana" to 4,
    "grape" to 5,
    "orange" to 6
)