#include<functional>
#include <algorithm>
#include  <iostream>
#include   <ctype.h>
#include   <cstring>
#include   <fstream>
#include    <cstdio>
#include    <vector>
#include    <string>
#include     <cmath>
#include     <deque>
#include     <stack>
#include     <queue>
#include      <list>
#include       <set>
#include       <map>
#define INF 0X7FFFFFFF
#define PI acos(-1.0)
typedef long long ll;
using namespace std;
const int N = 1e6;
inline int getint()
{
	int w = 0, q = 0;
	char c = getchar();
	while ((c<'0' || c>'9') && c != '-') c = getchar();
	if (c == '-') q = 1, c = getchar();
	while (c >= '0'&&c <= '9') w = w * 10 + c - '0', c = getchar();
	return q ? -w : w;
}
char s[1000];
int main() {
	char x;
	int cnt = 0;
	while (x = getchar()) {
		if (x == '\n') {
			break;
		}
		if (x == 'B') {
			if (cnt > 0) {
				cnt--;
			}
			continue;
		}
		s[cnt++] = x;
	}
	s[cnt] = '\0';
	printf("%s\n", s);
	return 0;
}