S = input()

ame = 0
if S[0] =="R":
    ame = 1
    if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3
else:
    if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1
print(ame) S = input() S input() input ame = 0 ame 0 if S[0] =="R":
    ame = 1
    if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3
else:
    if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1 S[0] =="R" S[0] S 0 "R" ame = 1 ame 1 if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3 S[1] == "R" S[1] S 1 "R" ame = 2 ame 2 if S[2] == "R":
            ame = 3 S[2] == "R" S[2] S 2 "R" ame = 3 ame 3 if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1 S[1] == "R" S[1] S 1 "R" ame = 1 ame 1 if S[2] == "R":
            ame = 2
     S[2] == "R" S[2] S 2 "R" ame = 2 ame 2 elif S[2] == "R":
        ame = 1 S[2] == "R" S[2] S 2 "R" ame = 1 ame 1 print(ame) print ame ame = 2 2 ame ame = 2 2 ame ame = 0 0 ame ame = 3 3 ame ame = 1 1 ame ame = 1 1 ame ame = 1 1 ame S = input() input() S
S = input()

ame = 0
if S[0] =="R":
    ame = 1
    if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3
else:
    if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1
print(ame)
