use std::io::{self, *}; struct Solution {} impl Solution { pub fn clearStr(self, input: String) -> String { let mut ans = String::from(""); for c in input.chars() { if !ans.is_empty() && c == ans.as_bytes()[ans.len()-1] as char { ans.pop(); continue; } ans.push(c); } if ans.is_empty() { return String::from("0"); } return ans; } } fn main() { let mut input = String::new(); io::stdin().read_line(&mut input).unwrap(); let mut input = input.trim_end().to_string(); println!("{}", Solution{}.clearStr(input)); }