using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using static Scanner;

class Solver
{
    static void Main(string[] args) {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        Solve();
        Console.Out.Flush();
    }
    static void Solve() {
        var s = StrSpan();
        Span<char> span = stackalloc char[s.Length];
        var p = 0;
        for (int i = 0; i < s.Length; i++) {
            var c = s[i];
            if (c == 'B' && p > 0) span[p--] = '-';
            if (c != 'B') span[p++] = s[i];
        }
        Console.WriteLine(span[..p].ToString());
    }
}

class Scanner
{
    const int BUFFER_SIZE = 1024, BEGIN = 33, END = 126, ZERO = 48, NINE = 57;
    static readonly Stream stdin = Console.OpenStandardInput();
    static readonly byte[] buffer = new byte[BUFFER_SIZE];
    static int size, p;
    static bool isEof;
  
    [MethodImpl(256)]
    private static byte Read() {
        if (isEof) return default;
        if (p < size) return buffer[p++];
        p = 0;
        if ((size = stdin.Read(buffer, 0, BUFFER_SIZE)) > 0) return buffer[p++];
        isEof = true;
        return 0;
    }
    [MethodImpl(256)]
    private static char Next() {
        byte b;
        do b = Read();
        while (b < BEGIN || END < b);
        return (char) b;
    }
    [MethodImpl(256)]
    public static string Str() {
        var sb = new StringBuilder();
        for (char c = Next(); BEGIN <= c && c <= END; c = (char) Read()) sb.Append(c);
        return sb.ToString();
    }
    [MethodImpl(256)]
    public static ReadOnlySpan<char> StrSpan() {
        var list = new List<char>();
        for (char c = Next(); BEGIN <= c && c <= END; c = (char) Read()) list.Add(c);
        return list.AsSpan();
    }
    [MethodImpl(256)]
    private static int Int() {
        int tmp = Next() - ZERO;
        for (var c = (char) Read(); ZERO <= c && c <= NINE; c = (char) Read()) tmp = tmp * 10 + c - ZERO;
        return tmp;
    }
    [MethodImpl(256)]
    private static long Long() {
        long tmp = Next() - ZERO;
        for (var c = (char) Read(); ZERO <= c && c <= NINE; c = (char) Read()) tmp = tmp * 10 + c - ZERO;
        return tmp;
    }
    [MethodImpl(256)]
    private static double Double() => double.Parse(Str(), CultureInfo.InvariantCulture);
    [MethodImpl(256)]
    public static string ScanLine() {
        var sb = new StringBuilder();
        for (var c = Next(); c != '\n' && c != 0; c = (char)Read()) if (c != '\r') sb.Append(c);
        return sb.ToString();
    }
    [MethodImpl(256)]
    public static T Scan<T>() 
        => default(T) switch 
            {int _ => (T) (object) Int(), long _ => (T) (object) Long(), string _ => (T) (object) Str(), _ => (T) (object) Double()};
    [MethodImpl(256)] public static (T, T) Dual<T>() => (Scan<T>(), Scan<T>());
    [MethodImpl(256)] public static (T, T, T) Tri<T>() => (Scan<T>(), Scan<T>(), Scan<T>());
    [MethodImpl(256)] public static (T, T, T, T) Quad<T>() => (Scan<T>(), Scan<T>(), Scan<T>(), Scan<T>());
    [MethodImpl(256)] public static (T, T, T, T, T) Quint<T>() => (Scan<T>(), Scan<T>(), Scan<T>(), Scan<T>(), Scan<T>());
    [MethodImpl(256)] public static (T1, T2) Scan<T1, T2>() => (Scan<T1>(), Scan<T2>());
    [MethodImpl(256)] public static (T1, T2, T3) Scan<T1, T2, T3>() => (Scan<T1>(), Scan<T2>(), Scan<T3>());
    [MethodImpl(256)] public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Scan<T1>(), Scan<T2>(), Scan<T3>(), Scan<T4>());
    [MethodImpl(256)] public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Scan<T1>(), Scan<T2>(), Scan<T3>(), Scan<T4>(), Scan<T5>());
    [MethodImpl(256)] public static (T1, T2, T3, T4, T5, T6) Scan<T1, T2, T3, T4, T5, T6>() => (Scan<T1>(), Scan<T2>(), Scan<T3>(), Scan<T4>(), Scan<T5>(), Scan<T6>());
}

static class ListExtention
{
    private class Wrapper<T> { public T[] Array; }
    [MethodImpl(256)]
    public static Span<T> AsSpan<T>(this List<T> list) => Unsafe.As<Wrapper<T>>(list).Array.AsSpan(0, list.Count);
}

Measured memory_bytes: 24280