pub fn decode_string(text: &str) -> String {
let mut stack: Vec<(String, i32)> = Vec::new();
let mut current_num: i32 = 0;
let mut current_string: String = String::new();
for character in text.chars() {
println!("{:?}",character);
if character == '[' {
stack.push((current_string.clone(), current_num.clone()));
current_string = String::from("");
current_num = 0;
} else if character == ']' {
let (prev_string, num) = stack.pop().unwrap();
current_string = prev_string + ¤t_string.repeat(num as usize);
} else if character.is_digit(10) {
current_num = current_num * 10 + character.to_digit(10).unwrap() as i32;
} else {
current_string.push(character);
}
}
current_string
}