#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define LL long long
#define eps 1e-6
using namespace std;
/*int n,m,k;
int b[8] = {128,64,32,16,8,4,2,1};
int a[1050][1050];
int vis[1050][1050];
struct A {
    int x,y,num;
};
queue<A> q;
int bfs(int x0,int y0,int x1,int y1) {
    //p123
    if(!q.empty()) {
        queue<A> empty;
        swap(empty,q);
    }
    re(vis,1);
    A x;
    x.x = x0;
    x.y = y0;
    x.num = 0;
    vis[x0][y0] = 0;
    q.push(x);
    while(!q.empty()) {
        //p123
        A qq = q.front();
        q.pop();
        if(qq.x == x1 && qq.y == y1) {
            return qq.num;
        }
        qq.num ++;
        if(a[qq.x+1][qq.y] != -1 && qq.x+1 != n+1 && vis[qq.x+1][qq.y] > qq.num) {
            qq.x ++;
            vis[qq.x][qq.y] = qq.num;

            q.push(qq);
            qq.x--;
        }
        if(a[qq.x-1][qq.y] != -1 && qq.x-1 != 0 && vis[qq.x-1][qq.y] > qq.num) {
            qq.x --;
            vis[qq.x][qq.y] = qq.num;
            q.push(qq);
            qq.x ++;
        }
        if(a[qq.x][qq.y+1] != -1 && qq.y+1 != m+1 && vis[qq.x][qq.y+1] > qq.num) {
            qq.y ++;
            vis[qq.x][qq.y] =qq.num;
            q.push(qq);
            qq.y--;
        }
        if(a[qq.x][qq.y-1] != -1 && qq.y-1 != 0 && vis[qq.x][qq.y-1] > qq.num) {
            qq.y --;
            vis[qq.x][qq.y] = qq.num;
            q.push(qq);
            qq.y ++;
        }
    }
    return -1;
}

int main() {
    freopen("in.txt","r",stdin);
    int T = 0;
    s(T );
    int sum = 0;
    int count0 = 0;
    while(T --){
        re(a,0);
        re(vis,1);
        s(n);
        m = n;
        int x0,x1,y0,y1;
        s(x0) s(y0) s(x1) s(y1);
        gc
        char c;
        re(a,0);
        for(int i = 1; i <= n; i ++) {
            for(int j = 1; j <= m; j ++) {
                c = gc;
                a[i][j] = 0;
                if(c == 'X') {
                    a[i][j] = -1;
                }
            }
            gc;
        }
        if(bfs(x0,y0,x1,y1) == -1){
                //p(0)
        }else{

            sum += b[count0];
        }
        count0 ++;
        if(count0 == 8){
            pc(sum);
            sum = 0;
            count0 = 0;
        }
        //p(bfs(x0,y0,x1,y1));
    }

    return 0;
}

*/

int main(){
    char a[10000];
    ss(a);
    char b[1000];
    int count0 = 0;
    for(int i = 0; i < len(a); i ++){
        if(a[i] == 'B'){
            if(count0 == 0){

            }else{
                count0 --;
            }
        }else{
            b[count0++] = a[i];
        }
    }
    for(int i = 0; i < count0 ; i ++){
        pc(b[i]);
    }
    pn

}





Measured memory_bytes: 256