/**
 * Given a string representation of a complex number in the form of 'a+bj',
 * this function should return a pair with the real and imaginary parts of the complex number.
 *
 * Example:
 * complexTuple("3+4j") returns Pair(3.0, 4.0)
 * complexTuple("5-2j") returns Pair(5.0, -2.0)
 * complexTuple("-2+7j") returns Pair(-2.0, 7.0)
 */
fun complexTuple(string: String): Pair<Double, Double> {

    // Remove whitespaces from the string
    var cleanedString = string.replace(" ", "")

    // Extract the real and imaginary parts from the string
    val parts = if ("+" in cleanedString) cleanedString.split("+") else cleanedString.split("-")
    val real = parts[0].toDouble()
    val imag = parts[1].replace("j", "").toDouble()

    return Pair(real, imag)
}
/**
 * Given a string representation of a complex number in the form of 'a+bj',
 * this function should return a pair with the real and imaginary parts of the complex number.
 *
 * Example:
 * complexTuple("3+4j") returns Pair(3.0, 4.0)
 * complexTuple("5-2j") returns Pair(5.0, -2.0)
 * complexTuple("-2+7j") returns Pair(-2.0, 7.0)
 */
fun complexTuple(string: String): Pair<Double, Double> {
/**
 * Given a string representation of a complex number in the form of 'a+bj',
 * this function should return a pair with the real and imaginary parts of the complex number.
 *
 * Example:
 * complexTuple("3+4j") returns Pair(3.0, 4.0)
 * complexTuple("5-2j") returns Pair(5.0, -2.0)
 * complexTuple("-2+7j") returns Pair(-2.0, 7.0)
 */
fun complexTuple(string: String): Pair<Double, Double> {

    // Remove whitespaces from the string
    var cleanedString = string.replace(" ", "")

    // Extract the real and imaginary parts from the string
    val parts = if ("+" in cleanedString) cleanedString.split("+") else cleanedString.split("-")
    val real = parts[0].toDouble()
    val imag = parts[1].replace("j", "").toDouble()

    return Pair(real, imag)
}