S = input()

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

elif (S[0] == S[1] == "R" and S[2] == "S") or (S[1] == S[2] == "R" and S[0] == "S"):
    print(2)

elif "R" in S:
    print(1)

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

elif (S[0] == S[1] == "R" and S[2] == "S") or (S[1] == S[2] == "R" and S[0] == "S"):
    print(2)

elif "R" in S:
    print(1)

else:
    print(0) S[0] == S[1] == S[2] == "R" S[0] == S[1] == S[2] S[0] == S[1] S[0] S 0 S[1] S 1 S[2] S 2 "R" print(3) print 3 elif (S[0] == S[1] == "R" and S[2] == "S") or (S[1] == S[2] == "R" and S[0] == "S"):
    print(2) (S[0] == S[1] == "R" and S[2] == "S") or (S[1] == S[2] == "R" and S[0] == "S") S[0] == S[1] == "R" and S[2] == "S" S[0] == S[1] == "R" S[0] == S[1] S[0] S 0 S[1] S 1 "R" S[2] == "S" S[2] S 2 "S" S[1] == S[2] == "R" and S[0] == "S" S[1] == S[2] == "R" S[1] == S[2] S[1] S 1 S[2] S 2 "R" S[0] == "S" S[0] S 0 "S" print(2) print 2 elif "R" in S:
    print(1) "R" in S "R" S print(1) print 1 print(0) print 0 S = input() input() S
S = input()

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

elif (S[0] == S[1] == "R" and S[2] == "S") or (S[1] == S[2] == "R" and S[0] == "S"):
    print(2)

elif "R" in S:
    print(1)

else:
    print(0)