S = str(input())
le = len(S)
s = []

for i in range(le):
    s.append(S[i])

r = s.count("R")

if r == 0:
    print(0)
elif r == 1:
    print(1)
elif r == 2:
    if s[1] == "S":
        print(1)
    else:
        print(2)
elif r == 3:
    print(3) S = str(input()) S str(input()) str input() input le = len(S) le len(S) len S s = [] s [] for i in range(le):
    s.append(S[i]) i range(le) range le s.append(S[i]) s.append s append S[i] S i r = s.count("R") r s.count("R") s.count s count "R" if r == 0:
    print(0)
elif r == 1:
    print(1)
elif r == 2:
    if s[1] == "S":
        print(1)
    else:
        print(2)
elif r == 3:
    print(3) r == 0 r 0 print(0) print 0 elif r == 1:
    print(1) r == 1 r 1 print(1) print 1 elif r == 2:
    if s[1] == "S":
        print(1)
    else:
        print(2) r == 2 r 2 if s[1] == "S":
        print(1)
    else:
        print(2) s[1] == "S" s[1] s 1 "S" print(1) print 1 print(2) print 2 elif r == 3:
    print(3) r == 3 r 3 print(3) print 3 le = len(S) len(S) le s = [] [] s r = s.count("R") s.count("R") r S = str(input()) str(input()) S
S = str(input())
le = len(S)
s = []

for i in range(le):
    s.append(S[i])

r = s.count("R")

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