/**
 * Given a list of tuples, the function 'loopAndCombine' takes each tuple and combines the pairs of elements
 * together to form a new string. It then calculates the total number of characters in all the new strings and
 * returns the result.
 *
 * @param tuples A list of tuples, where each tuple contains two elements.
 * @return The total number of characters in all the new strings formed by combining the tuples.
 *
 * Example:
 * If tuples = [('Hello', 'World'), ('Python', 'Programming'), ('Code', 'Completion')], the function should return 31,
 * because when we combine the pairs of elements in each tuple, we get: 'HelloWorld', 'PythonProgramming',
 * 'CodeCompletion', and the total number of characters in these three strings is 31.
 */
fun loopAndCombine(tuples: List<Pair<String, String>>): Int {

    val combinedStrings = tuples.map { it.first + it.second }
    return combinedStrings.sumBy { it.length }
}
/**
 * Given a list of tuples, the function 'loopAndCombine' takes each tuple and combines the pairs of elements
 * together to form a new string. It then calculates the total number of characters in all the new strings and
 * returns the result.
 *
 * @param tuples A list of tuples, where each tuple contains two elements.
 * @return The total number of characters in all the new strings formed by combining the tuples.
 *
 * Example:
 * If tuples = [('Hello', 'World'), ('Python', 'Programming'), ('Code', 'Completion')], the function should return 31,
 * because when we combine the pairs of elements in each tuple, we get: 'HelloWorld', 'PythonProgramming',
 * 'CodeCompletion', and the total number of characters in these three strings is 31.
 */
fun loopAndCombine(tuples: List<Pair<String, String>>): Int {
/**
 * Given a list of tuples, the function 'loopAndCombine' takes each tuple and combines the pairs of elements
 * together to form a new string. It then calculates the total number of characters in all the new strings and
 * returns the result.
 *
 * @param tuples A list of tuples, where each tuple contains two elements.
 * @return The total number of characters in all the new strings formed by combining the tuples.
 *
 * Example:
 * If tuples = [('Hello', 'World'), ('Python', 'Programming'), ('Code', 'Completion')], the function should return 31,
 * because when we combine the pairs of elements in each tuple, we get: 'HelloWorld', 'PythonProgramming',
 * 'CodeCompletion', and the total number of characters in these three strings is 31.
 */
fun loopAndCombine(tuples: List<Pair<String, String>>): Int {

    val combinedStrings = tuples.map { it.first + it.second }
    return combinedStrings.sumBy { it.length }
}