Q =input()
if Q.count('R')==3:
    print(3)
elif Q.count('R')==0:
    print(0)
elif Q.count('R')==1:
    print(1)
elif Q.count('R')==2:
    if Q[1] =='S':
        print(1)
    else :
        print(2) Q =input() Q input() input if Q.count('R')==3:
    print(3)
elif Q.count('R')==0:
    print(0)
elif Q.count('R')==1:
    print(1)
elif Q.count('R')==2:
    if Q[1] =='S':
        print(1)
    else :
        print(2) Q.count('R')==3 Q.count('R') Q.count Q count 'R' 3 print(3) print 3 elif Q.count('R')==0:
    print(0) Q.count('R')==0 Q.count('R') Q.count Q count 'R' 0 print(0) print 0 elif Q.count('R')==1:
    print(1) Q.count('R')==1 Q.count('R') Q.count Q count 'R' 1 print(1) print 1 elif Q.count('R')==2:
    if Q[1] =='S':
        print(1)
    else :
        print(2) Q.count('R')==2 Q.count('R') Q.count Q count 'R' 2 if Q[1] =='S':
        print(1)
    else :
        print(2) Q[1] =='S' Q[1] Q 1 'S' print(1) print 1 print(2) print 2 Q =input() input() Q
Q =input()
if Q.count('R')==3:
    print(3)
elif Q.count('R')==0:
    print(0)
elif Q.count('R')==1:
    print(1)
elif Q.count('R')==2:
    if Q[1] =='S':
        print(1)
    else :
        print(2)