S = input() A = [i for i in range(2**len(S), 2**len(S)*2)] for c in S: if c == 'L': A = A[:len(A)//2] else: A = A[len(A)//2:] print(A[0])