/**
 * Given four lowercase strings (a, b, c, and d), the function returns a modified version of string 'a'.
 *
 * The function performs the following steps:
 * 1. Replace the first character of string 'a' with the first character of string 'b', but in uppercase.
 * 2. Replace the second character of string 'a' with the last character of string 'c'.
 * 3. Replace characters in string 'a' from index 2 to (length of string 'a' - 2) with the characters of string 'd' in reverse.
 * 4. Return the modified string 'a'.
 *
 * Example:
 * - If a = 'python', b = 'athlete', c = 'indexing', and d = 'slicing', the function will return 'APgacs'.
 */
fun sliceAndIndex(a: String, b: String, c: String, d: String): String {

    var modifiedA = b[0].toUpperCase() + a.substring(1)
    modifiedA = modifiedA.substring(0, 1) + c.last() + modifiedA.substring(2, modifiedA.length - 2).reversed() + modifiedA.last()

    return modifiedA
}
/**
 * Given four lowercase strings (a, b, c, and d), the function returns a modified version of string 'a'.
 *
 * The function performs the following steps:
 * 1. Replace the first character of string 'a' with the first character of string 'b', but in uppercase.
 * 2. Replace the second character of string 'a' with the last character of string 'c'.
 * 3. Replace characters in string 'a' from index 2 to (length of string 'a' - 2) with the characters of string 'd' in reverse.
 * 4. Return the modified string 'a'.
 *
 * Example:
 * - If a = 'python', b = 'athlete', c = 'indexing', and d = 'slicing', the function will return 'APgacs'.
 */
fun sliceAndIndex(a: String, b: String, c: String, d: String): String {
/**
 * Given four lowercase strings (a, b, c, and d), the function returns a modified version of string 'a'.
 *
 * The function performs the following steps:
 * 1. Replace the first character of string 'a' with the first character of string 'b', but in uppercase.
 * 2. Replace the second character of string 'a' with the last character of string 'c'.
 * 3. Replace characters in string 'a' from index 2 to (length of string 'a' - 2) with the characters of string 'd' in reverse.
 * 4. Return the modified string 'a'.
 *
 * Example:
 * - If a = 'python', b = 'athlete', c = 'indexing', and d = 'slicing', the function will return 'APgacs'.
 */
fun sliceAndIndex(a: String, b: String, c: String, d: String): String {

    var modifiedA = b[0].toUpperCase() + a.substring(1)
    modifiedA = modifiedA.substring(0, 1) + c.last() + modifiedA.substring(2, modifiedA.length - 2).reversed() + modifiedA.last()

    return modifiedA
}