s = eval(input())

if s == 'SSS':

  print((0))

elif s == 'RRR':

  print((3))

elif s == 'RRS' or s == 'SRR':

  print((2))

else:

  print((1))
s = eval(input())

if s == 'RRR':

  print((3))

elif s == 'RRS' or s == 'SRR':

  print((2))

elif s == 'SSS':

  print((0))

else:

  print((1))
s = eval(input())
if s == "SSS":
    print((0))
elif s == "RRR":
    print((3))
elif s == "RRS" or s == "SRR":
    print((2))
else:
    print((1))

s = eval(input())
if s == "RRR":
    print((3))
elif s == "RRS" or s == "SRR":
    print((2))
elif s == "SSS":
    print((0))
else:
    print((1))

-if s == "SSS": -    print((0)) -elif s == "RRR": +if s == "RRR": +elif s == "SSS": +    print((0))