/**
 * Given a list of tuples, swap the elements present in each tuple using a while loop.
 *
 * @param inputList a list of tuples
 * @return the modified list of tuples with swapped elements
 */
fun swapElementsWhileLoop(inputList: List<Pair<Any, Any>>): List<Pair<Any, Any>> {

    // Initialize an empty list to store the modified tuples
    val result = mutableListOf<Pair<Any, Any>>()
    
    // Iterate through each tuple in the inputList
    var index = 0
    while (index < inputList.size) {
        // Swap the first and second elements of the current tuple
        val currentTuple = inputList[index]
        val swappedTuple = Pair(currentTuple.second, currentTuple.first)
        
        // Append the modified tuple to the result list
        result.add(swappedTuple)
        
        // Increment the index
        index++
    }
    
    return result
}
/**
 * Given a list of tuples, swap the elements present in each tuple using a while loop.
 *
 * @param inputList a list of tuples
 * @return the modified list of tuples with swapped elements
 */
fun swapElementsWhileLoop(inputList: List<Pair<Any, Any>>): List<Pair<Any, Any>> {
/**
 * Given a list of tuples, swap the elements present in each tuple using a while loop.
 *
 * @param inputList a list of tuples
 * @return the modified list of tuples with swapped elements
 */
fun swapElementsWhileLoop(inputList: List<Pair<Any, Any>>): List<Pair<Any, Any>> {

    // Initialize an empty list to store the modified tuples
    val result = mutableListOf<Pair<Any, Any>>()
    
    // Iterate through each tuple in the inputList
    var index = 0
    while (index < inputList.size) {
        // Swap the first and second elements of the current tuple
        val currentTuple = inputList[index]
        val swappedTuple = Pair(currentTuple.second, currentTuple.first)
        
        // Append the modified tuple to the result list
        result.add(swappedTuple)
        
        // Increment the index
        index++
    }
    
    return result
}