s = eval(input())

if s[0] == "R":

    if s[1] == "R":

        if s[2] == "R":

            print("3")

        else:

            print("2")

    else:

        print("1")

            

elif s[1] == "R":

    if s[2] == "R":

        print("2")

    else:

        print("1")

elif s[2] == "R":

        print("1")

else:

    print("0")
s = eval(input())



r = ["RRS","RRR","RSR","SRR","SSR","RSS","SSS","SRS"]

ra = [2,3,1,2,1,1,0,1]

for i in range(8):

    if r[i] == s:

        print((ra[i]))
s = eval(input())
if s[0] == "R":
    if s[1] == "R":
        if s[2] == "R":
            print("3")
        else:
            print("2")
    else:
        print("1")
elif s[1] == "R":
    if s[2] == "R":
        print("2")
    else:
        print("1")
elif s[2] == "R":
    print("1")
else:
    print("0")

s = eval(input())
r = ["RRS", "RRR", "RSR", "SRR", "SSR", "RSS", "SSS", "SRS"]
ra = [2, 3, 1, 2, 1, 1, 0, 1]
for i in range(8):
    if r[i] == s:
        print((ra[i]))

-if s[0] == "R": -    if s[1] == "R": -        if s[2] == "R": -            print("3") -        else: -            print("2") -    else: -        print("1") -elif s[1] == "R": -    if s[2] == "R": -        print("2") -    else: -        print("1") -elif s[2] == "R": -    print("1") -else: -    print("0") +r = ["RRS", "RRR", "RSR", "SRR", "SSR", "RSS", "SSS", "SRS"] +ra = [2, 3, 1, 2, 1, 1, 0, 1] +for i in range(8): +    if r[i] == s: +        print((ra[i]))