CHARACTER(10) S
CHARACTER(10) ANSWER
INTEGER MOJI
READ*,S
MOJI=0
ANSWER=""
DO I=1,LEN_TRIM(S)
	IF (S(I:I) /= "B") THEN
    	ANSWER=TRIM(ANSWER)//S(I:I)
        MOJI=MOJI+1
    ELSE
    	IF(MOJI /= 0)THEN
        ANSWER=ANSWER(:MOJI-1)
    	MOJI=MOJI-1
    	ENDIF
    ENDIF
END DO
PRINT"(A)",TRIM(ANSWER)
END