# AtCoder Beginner Contest 175



S=eval(input())

if S=="SSS":

    print((0))

    exit()

if S=="SRR" or S=="RRS":

    print((2))

    exit()

if S=="RRR":

    print((3))

    exit()

else:

    print((1))
# AtCoder Beginner Contest 175

# A - Rainy Season



S=eval(input())

if S=="RRR":

    print((3))

    exit()

if S=="SRR" or S=="RRS":

    print((2))

    exit()

if S=="SSS":

    print((0))

    exit()

else:

    print((1))
# AtCoder Beginner Contest 175
S = eval(input())
if S == "SSS":
    print((0))
    exit()
if S == "SRR" or S == "RRS":
    print((2))
    exit()
if S == "RRR":
    print((3))
    exit()
else:
    print((1))

# AtCoder Beginner Contest 175
# A - Rainy Season
S = eval(input())
if S == "RRR":
    print((3))
    exit()
if S == "SRR" or S == "RRS":
    print((2))
    exit()
if S == "SSS":
    print((0))
    exit()
else:
    print((1))

+# A - Rainy Season -if S == "SSS": -    print((0)) +if S == "RRR": +    print((3)) -if S == "RRR": -    print((3)) +if S == "SSS": +    print((0))