s = eval(input())

a = "SSS"

b = "RRR"

c = ["SRR", "RRS"]

if s == a:

    x = 0

elif s == b:

    x = 3

elif s in c:

    x = 2

else:

    x = 1

print(x)
s = eval(input())

if s == "RRR":

    x = 3

elif s == "RRS" or s == "SRR":

    x = 2

elif s == "SSS":

    x = 0

else:

    x = 1

print(x)
s = eval(input())
a = "SSS"
b = "RRR"
c = ["SRR", "RRS"]
if s == a:
    x = 0
elif s == b:
    x = 3
elif s in c:
    x = 2
else:
    x = 1
print(x)

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

-a = "SSS" -b = "RRR" -c = ["SRR", "RRS"] -if s == a: +if s == "RRR": +    x = 3 +elif s == "RRS" or s == "SRR": +    x = 2 +elif s == "SSS": -elif s == b: -    x = 3 -elif s in c: -    x = 2