fn collapse_polymer(polymer: &str) -> String {
    // I really don't like this, but it's simple and easy
    lazy_static! {
        static ref re: Regex = Regex::new(r"aA|bB|cC|dD|eE|fF|gG|hH|iI|jJ|kK|lL|mM|nN|oO|pP|qQ|rR|sS|tT|uU|vV|wW|xX|yY|zZ|Aa|Bb|Cc|Dd|Ee|Ff|Gg|Hh|Ii|Jj|Kk|Ll|Mm|Nn|Oo|Pp|Qq|Rr|Ss|Tt|Uu|Vv|Ww|Xx|Yy|Zz").unwrap();
    }

    let mut result = polymer.to_owned();

    loop {
        let new_result = re.replace_all(&result, "");
        if new_result == result {
            break;
        }
        result = new_result.to_owned().to_string();
    }

    result
}
// TODO: Refactor this to be more efficient
Refactor this to be more efficient
Refactor this to be more efficient
fn collapse_polymer(polymer: &str) -> String {
    // I really don't like this, but it's simple and easy
    lazy_static! {
        static ref re: Regex = Regex::new(r"aA|bB|cC|dD|eE|fF|gG|hH|iI|jJ|kK|lL|mM|nN|oO|pP|qQ|rR|sS|tT|uU|vV|wW|xX|yY|zZ|Aa|Bb|Cc|Dd|Ee|Ff|Gg|Hh|Ii|Jj|Kk|Ll|Mm|Nn|Oo|Pp|Qq|Rr|Ss|Tt|Uu|Vv|Ww|Xx|Yy|Zz").unwrap();
    }
    let mut result = polymer.to_owned();
    loop {
        let new_result = re.replace_all(&result, "");
        if new_result == result {
            break;
        }
        result = new_result.to_owned().to_string();
    }
    result
}
fn collapse_polymer ( polymer : & str ) -> String { // I really don't like this, but it's simple and easy lazy_static ! { static ref re Regex Regex new ( r"aA|bB|cC|dD|eE|fF|gG|hH|iI|jJ|kK|lL|mM|nN|oO|pP|qQ|rR|sS|tT|uU|vV|wW|xX|yY|zZ|Aa|Bb|Cc|Dd|Ee|Ff|Gg|Hh|Ii|Jj|Kk|Ll|Mm|Nn|Oo|Pp|Qq|Rr|Ss|Tt|Uu|Vv|Ww|Xx|Yy|Zz" ) unwrap ( ) } let mut result = polymer . to_owned ( ) ; loop { let new_result = re . replace_all ( & result , " " ) ; if new_result == result { break ; } result = new_result . to_owned ( ) . to_string ( ) ; } result }
TODO: Refactor this to be more efficient
TODO : Refactor this to be more efficient
polymer
&str