while 1: a=[0] for c in raw_input(): b=[];p=1 for e in a:b+=e-1,e+1;p*=e a=(a[1:],a[:-1],[sum(a)],[p],b)[ord(c)/2%5] print`a`.replace("L","")