/**
 * In genetics, a nucleotide sequence represents the order of nucleotides in a DNA or RNA molecule.
 * Complete the function below to replace all occurrences of a specific nucleotide in a sequence with a new nucleotide.
 * The function should return the modified sequence.
 *
 * @param sequence The original nucleotide sequence.
 * @param oldBase The nucleotide to be replaced.
 * @param newBase The nucleotide to replace the old nucleotide.
 * @return The modified nucleotide sequence with replaced nucleotides.
 */
fun replaceNucleotide(sequence: String, oldBase: Char, newBase: Char): String {

    var modifiedSequence = sequence
    var i = 0
    while (i < modifiedSequence.length) {
        if (modifiedSequence[i] == oldBase) {
            modifiedSequence = modifiedSequence.substring(0, i) + newBase + modifiedSequence.substring(i + 1)
            i--
        }
        i++
    }
    return modifiedSequence
}
/**
 * In genetics, a nucleotide sequence represents the order of nucleotides in a DNA or RNA molecule.
 * Complete the function below to replace all occurrences of a specific nucleotide in a sequence with a new nucleotide.
 * The function should return the modified sequence.
 *
 * @param sequence The original nucleotide sequence.
 * @param oldBase The nucleotide to be replaced.
 * @param newBase The nucleotide to replace the old nucleotide.
 * @return The modified nucleotide sequence with replaced nucleotides.
 */
fun replaceNucleotide(sequence: String, oldBase: Char, newBase: Char): String {
/**
 * In genetics, a nucleotide sequence represents the order of nucleotides in a DNA or RNA molecule.
 * Complete the function below to replace all occurrences of a specific nucleotide in a sequence with a new nucleotide.
 * The function should return the modified sequence.
 *
 * @param sequence The original nucleotide sequence.
 * @param oldBase The nucleotide to be replaced.
 * @param newBase The nucleotide to replace the old nucleotide.
 * @return The modified nucleotide sequence with replaced nucleotides.
 */
fun replaceNucleotide(sequence: String, oldBase: Char, newBase: Char): String {

    var modifiedSequence = sequence
    var i = 0
    while (i < modifiedSequence.length) {
        if (modifiedSequence[i] == oldBase) {
            modifiedSequence = modifiedSequence.substring(0, i) + newBase + modifiedSequence.substring(i + 1)
            i--
        }
        i++
    }
    return modifiedSequence
}