/**
 * This function takes a string 'text' as input and returns a tuple containing data extracted
 * from the string.
 *
 * The input string consists of multiple lines, each having the format "<key>: <value>".
 * This function extracts the values corresponding to the keys 'name', 'age', and 'location'
 * from the string and returns them as a tuple in the same order.
 *
 * Example:
 * >>> extractData("name: John\nage: 25\nlocation: Paris")
 * ('John', '25', 'Paris')
 */
fun extractData(text: String): Triple<String, String, String> {

    val data = text.trim().split('\n')
    var name = ""
    var age = ""
    var location = ""

    for (line in data) {
        val (key, value) = line.split(':')
        val trimmedKey = key.trim()
        val trimmedValue = value.trim()

        when (trimmedKey) {
            "name" -> name = trimmedValue
            "age" -> age = trimmedValue
            "location" -> location = trimmedValue
        }
    }

    return Triple(name, age, location)
}
/**
 * This function takes a string 'text' as input and returns a tuple containing data extracted
 * from the string.
 *
 * The input string consists of multiple lines, each having the format "<key>: <value>".
 * This function extracts the values corresponding to the keys 'name', 'age', and 'location'
 * from the string and returns them as a tuple in the same order.
 *
 * Example:
 * >>> extractData("name: John\nage: 25\nlocation: Paris")
 * ('John', '25', 'Paris')
 */
fun extractData(text: String): Triple<String, String, String> {
/**
 * This function takes a string 'text' as input and returns a tuple containing data extracted
 * from the string.
 *
 * The input string consists of multiple lines, each having the format "<key>: <value>".
 * This function extracts the values corresponding to the keys 'name', 'age', and 'location'
 * from the string and returns them as a tuple in the same order.
 *
 * Example:
 * >>> extractData("name: John\nage: 25\nlocation: Paris")
 * ('John', '25', 'Paris')
 */
fun extractData(text: String): Triple<String, String, String> {

    val data = text.trim().split('\n')
    var name = ""
    var age = ""
    var location = ""

    for (line in data) {
        val (key, value) = line.split(':')
        val trimmedKey = key.trim()
        val trimmedValue = value.trim()

        when (trimmedKey) {
            "name" -> name = trimmedValue
            "age" -> age = trimmedValue
            "location" -> location = trimmedValue
        }
    }

    return Triple(name, age, location)
}