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