/**
 * This function takes in two artist names as arguments and returns a string containing all the common letters
 * between the two names, using a while loop and tuple slicing.
 *
 * @param artist1 The name of the first artist.
 * @param artist2 The name of the second artist.
 * @return A string containing all the common letters between the two artists' names.
 * @throws IllegalArgumentException If either artist's name is an empty string.
 */
fun findCommonLetters(artist1: String, artist2: String): String {

    if (artist1.isEmpty() || artist2.isEmpty()) {
        throw IllegalArgumentException("Artist name cannot be empty")
    }

    var commonLetters = ""
    var i = 0

    while (i < artist1.length) {
        var j = 0
        while (j < artist2.length) {
            if (artist1[i] == artist2[j]) {
                commonLetters += artist1[i]
                break
            }
            j++
        }
        i++
    }

    return commonLetters
}
/**
 * This function takes in two artist names as arguments and returns a string containing all the common letters
 * between the two names, using a while loop and tuple slicing.
 *
 * @param artist1 The name of the first artist.
 * @param artist2 The name of the second artist.
 * @return A string containing all the common letters between the two artists' names.
 * @throws IllegalArgumentException If either artist's name is an empty string.
 */
fun findCommonLetters(artist1: String, artist2: String): String {
/**
 * This function takes in two artist names as arguments and returns a string containing all the common letters
 * between the two names, using a while loop and tuple slicing.
 *
 * @param artist1 The name of the first artist.
 * @param artist2 The name of the second artist.
 * @return A string containing all the common letters between the two artists' names.
 * @throws IllegalArgumentException If either artist's name is an empty string.
 */
fun findCommonLetters(artist1: String, artist2: String): String {

    if (artist1.isEmpty() || artist2.isEmpty()) {
        throw IllegalArgumentException("Artist name cannot be empty")
    }

    var commonLetters = ""
    var i = 0

    while (i < artist1.length) {
        var j = 0
        while (j < artist2.length) {
            if (artist1[i] == artist2[j]) {
                commonLetters += artist1[i]
                break
            }
            j++
        }
        i++
    }

    return commonLetters
}