/**
 * Given a string [text], returns the substring starting from the nth character to the (-m)th character,
 * where n and m are integer inputs. Returns an empty string if either n or m is out of bounds or if m < n.
 *
 * Example:
 * input: text = "Python is awesome", n = 2, m = 6
 * output: "thon i"
 *
 * input: text = "This is a test", n = 5, m = 2
 * output: ""
 */
fun stringSlicingExercise(text: String, n: Int, m: Int): String {

    if (n < 0 || m < 0 || m < n || n >= text.length || -m > text.length) {
        return ""
    }
    return text.substring(n, text.length + m)
}
/**
 * Given a string [text], returns the substring starting from the nth character to the (-m)th character,
 * where n and m are integer inputs. Returns an empty string if either n or m is out of bounds or if m < n.
 *
 * Example:
 * input: text = "Python is awesome", n = 2, m = 6
 * output: "thon i"
 *
 * input: text = "This is a test", n = 5, m = 2
 * output: ""
 */
fun stringSlicingExercise(text: String, n: Int, m: Int): String {
/**
 * Given a string [text], returns the substring starting from the nth character to the (-m)th character,
 * where n and m are integer inputs. Returns an empty string if either n or m is out of bounds or if m < n.
 *
 * Example:
 * input: text = "Python is awesome", n = 2, m = 6
 * output: "thon i"
 *
 * input: text = "This is a test", n = 5, m = 2
 * output: ""
 */
fun stringSlicingExercise(text: String, n: Int, m: Int): String {

    if (n < 0 || m < 0 || m < n || n >= text.length || -m > text.length) {
        return ""
    }
    return text.substring(n, text.length + m)
}