/**
 * Given a string, replace all vowels with 'x' using a while loop.
 *
 * @param string The input string.
 * @return The modified string with replaced vowels.
 *
 * Example:
 * replaceVowelsWithX("engineering") -> 'xngnxrxng'
 */
fun replaceVowelsWithX(string: String): String {

    var index = 0
    var modifiedString = string

    while (index < modifiedString.length) {
        if (modifiedString[index] in listOf('a', 'e', 'i', 'o', 'u')) {
            modifiedString = modifiedString.substring(0, index) + 'x' + modifiedString.substring(index + 1)
        }
        index++
    }

    return modifiedString
}
/**
 * Given a string, replace all vowels with 'x' using a while loop.
 *
 * @param string The input string.
 * @return The modified string with replaced vowels.
 *
 * Example:
 * replaceVowelsWithX("engineering") -> 'xngnxrxng'
 */
fun replaceVowelsWithX(string: String): String {
/**
 * Given a string, replace all vowels with 'x' using a while loop.
 *
 * @param string The input string.
 * @return The modified string with replaced vowels.
 *
 * Example:
 * replaceVowelsWithX("engineering") -> 'xngnxrxng'
 */
fun replaceVowelsWithX(string: String): String {

    var index = 0
    var modifiedString = string

    while (index < modifiedString.length) {
        if (modifiedString[index] in listOf('a', 'e', 'i', 'o', 'u')) {
            modifiedString = modifiedString.substring(0, index) + 'x' + modifiedString.substring(index + 1)
        }
        index++
    }

    return modifiedString
}