using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static ABC.Cin;
using static ABC.Cout;
using static ABC.Tool;


namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Str;
            var ans = new StringBuilder();
            for(int i = 0; i < s.Length; i++)
            {
                if (s[i] == '0')
                {
                    ans.Append(0);
                }
                if (s[i] == '1')
                {
                    ans.Append(1);
                }
                if (s[i] == 'B')
                {
                    if(ans.Length == 0)
                    {
                        continue;
                    }
                    ans.Remove(ans.Length - 1, 1);
                }
            }
            OutL(ans);
        }
    }

    static class Cin
    {
        public static string[] ReadSplit => Console.ReadLine().Split();
        public static int[] ReadSplitInt => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] ReadSplitLong => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string Str => Console.ReadLine();
        public static int Int => int.Parse(Console.ReadLine());
        public static long Long => long.Parse(Console.ReadLine());
        public static double Double => double.Parse(Console.ReadLine());
        public static T Conv<T>(string input)
        {
            return (T)Convert.ChangeType(input, typeof(T));
        }
        public static void Scanf<T>(out T a) => a = Conv<T>(Console.ReadLine());
        public static void Scanf<T,U>(out T a, out U b)
        {
            var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]);
        }
        public static void Scanf<T, U, V>(out T a, out U b, out V c)
        {
            var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]);
        }
        public static void Scanf<T, U, V, W>(out T a, out U b, out V c, out W d)
        {
            var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]); d = Conv<W>(q[3]);
        }
    }
    static class Cout
    {
        public static void OutL(object s) => Console.WriteLine(s);
    }
    static class Tool
    {
        public static long Gcd(long a, long b)
        {
            if (a % b == 0)
            {
                return b;
            }
            else
            {
                return Gcd(b, a % b);
            }
        }
        public static long Lcm(long a, long b) => a * b / Gcd(a, b);

        public static long[] PrimeFac(long n)
        {
            var result = new long[n + 1];
            for(int i = 2; i * i <= n; i++)
            {
                if (n % i != 0)
                {
                    continue;
                }

                var cnt = 0;
                while(n % i == 0)
                {
                    cnt++;
                    n /= i;
                }
                result[i] = cnt;
            }
            if(n != 1)
            {
                result[n] = 1;
            }
            return result;
        }
        public static long DivsCnt(long n)
        {
            var result = 1L;
            for (int i = 2; i * i <= n; i++)
            {
                if (n % i != 0)
                {
                    continue;
                }

                var cnt = 0;
                while (n % i == 0)
                {
                    cnt++;
                    n /= i;
                }
                result *= (cnt + 1);
            }
            if (n != 1)
            {
                result *= 2;
            }
            return result;
        }
    }
}

Measured memory_bytes: 25840