/**
 * This function takes a tuple containing two names as input and swaps the positions of the names.
 *
 * @param namesTuple A tuple containing two names.
 * @return A new tuple with the names exchanged.
 *
 * Example:
 * swapNames(Pair("John", "Doe")) returns Pair("Doe", "John")
 */
fun swapNames(namesTuple: Pair<String, String>): Pair<String, String> {

    // Check if input is a tuple
    if (namesTuple !is Pair<*, *>) {
        return Pair("Input must be a tuple", "")
    }

    // Check if tuple contains exactly two elements
    if (namesTuple.toList().size != 2) {
        return Pair("Input tuple must contain two names", "")
    }

    // Extract the names from the tuple
    val (name1, name2) = namesTuple

    // Swap the positions of the names
    return Pair(name2, name1)
}
/**
 * This function takes a tuple containing two names as input and swaps the positions of the names.
 *
 * @param namesTuple A tuple containing two names.
 * @return A new tuple with the names exchanged.
 *
 * Example:
 * swapNames(Pair("John", "Doe")) returns Pair("Doe", "John")
 */
fun swapNames(namesTuple: Pair<String, String>): Pair<String, String> {
/**
 * This function takes a tuple containing two names as input and swaps the positions of the names.
 *
 * @param namesTuple A tuple containing two names.
 * @return A new tuple with the names exchanged.
 *
 * Example:
 * swapNames(Pair("John", "Doe")) returns Pair("Doe", "John")
 */
fun swapNames(namesTuple: Pair<String, String>): Pair<String, String> {

    // Check if input is a tuple
    if (namesTuple !is Pair<*, *>) {
        return Pair("Input must be a tuple", "")
    }

    // Check if tuple contains exactly two elements
    if (namesTuple.toList().size != 2) {
        return Pair("Input tuple must contain two names", "")
    }

    // Extract the names from the tuple
    val (name1, name2) = namesTuple

    // Swap the positions of the names
    return Pair(name2, name1)
}