Rust Largest String
fn largest_string(s: &str) -> String {
    let mut bytes: Vec<u8> = s.bytes().collect();
    let len = bytes.len() as i64;
    let mut cur: Vec<u8> = Vec::new();

    let mut i = len - 1;
    while i >= 0 {
        cur.insert(0, bytes[i as usize]);

        if cur.len() == 3 {
            if cur == b"abb" {
                bytes[i as usize] = b'b';
                bytes[i as usize + 1] = b'a';
                bytes[i as usize + 2] = b'a';

                if bytes.get(i as usize + 4) == Some(&b'b') {
                    i += 4 + 1;
                } else if bytes.get(i as usize + 3) == Some(&b'b') {
                    i += 3 + 1;
                } else if bytes.get(i as usize + 2) == Some(&b'b') {
                    i += 2 + 1;
                }
            }
            if bytes.get(i as usize + 1) == Some(&b'b') {
                i += 1 + 1;
            } else {
                i += 1;
            }
            cur.clear();
        }

        i -= 1;
    }

    String::from_utf8(bytes).unwrap()
}

This builds the biggest valid string it can under the challenge rules by always choosing the best next character it is allowed to use.