local str = io.read()
local len = #str
local ret = ""
for i = 1, len do
  local sstr = str:sub(i, i)
  if sstr == "B" then
    if(0 < #ret) then ret = ret:sub(1, #ret - 1) end
  else
    ret = ret .. sstr
  end
end
print(ret)