/**
 * This function takes two complex numbers as input and returns their concatenation as a string.
 *
 * @param complex1 The first complex number in the form 'a+bj'.
 * @param complex2 The second complex number in the form 'c+dj'.
 * @return The concatenation of the two complex numbers.
 *
 * Example:
 * concatenateComplexNumbers("2+3j", "-4+7j") returns "2+3j-4+7j"
 */
fun concatenateComplexNumbers(complex1: String, complex2: String): String {

    val parts1 = complex1.split("+")
    val parts2 = complex2.split("+")
    val real1 = parts1[0].toDouble()
    val imag1 = parts1[1].substring(0, parts1[1].length - 1).toDouble()
    val real2 = parts2[0].toDouble()
    val imag2 = parts2[1].substring(0, parts2[1].length - 1).toDouble()
    val resultReal = real1 + real2
    val resultImag = imag1 + imag2
    return "$resultReal+$resultImag" + "j"
}
/**
 * This function takes two complex numbers as input and returns their concatenation as a string.
 *
 * @param complex1 The first complex number in the form 'a+bj'.
 * @param complex2 The second complex number in the form 'c+dj'.
 * @return The concatenation of the two complex numbers.
 *
 * Example:
 * concatenateComplexNumbers("2+3j", "-4+7j") returns "2+3j-4+7j"
 */
fun concatenateComplexNumbers(complex1: String, complex2: String): String {
/**
 * This function takes two complex numbers as input and returns their concatenation as a string.
 *
 * @param complex1 The first complex number in the form 'a+bj'.
 * @param complex2 The second complex number in the form 'c+dj'.
 * @return The concatenation of the two complex numbers.
 *
 * Example:
 * concatenateComplexNumbers("2+3j", "-4+7j") returns "2+3j-4+7j"
 */
fun concatenateComplexNumbers(complex1: String, complex2: String): String {

    val parts1 = complex1.split("+")
    val parts2 = complex2.split("+")
    val real1 = parts1[0].toDouble()
    val imag1 = parts1[1].substring(0, parts1[1].length - 1).toDouble()
    val real2 = parts2[0].toDouble()
    val imag2 = parts2[1].substring(0, parts2[1].length - 1).toDouble()
    val resultReal = real1 + real2
    val resultImag = imag1 + imag2
    return "$resultReal+$resultImag" + "j"
}