S=input()
if S=="SSS":
    print(0)
else:
    if S=="RSS" or S=="SRS":
        print(1)
    else:
        if S=="SSR" or S=="RSR":
            print(1)
        else:
            if S=="RRS" or S=="SRR":
                print(2)
            else:
                print(3) S=input() S input() input if S=="SSS":
    print(0)
else:
    if S=="RSS" or S=="SRS":
        print(1)
    else:
        if S=="SSR" or S=="RSR":
            print(1)
        else:
            if S=="RRS" or S=="SRR":
                print(2)
            else:
                print(3) S=="SSS" S "SSS" print(0) print 0 if S=="RSS" or S=="SRS":
        print(1)
    else:
        if S=="SSR" or S=="RSR":
            print(1)
        else:
            if S=="RRS" or S=="SRR":
                print(2)
            else:
                print(3) S=="RSS" or S=="SRS" S=="RSS" S "RSS" S=="SRS" S "SRS" print(1) print 1 if S=="SSR" or S=="RSR":
            print(1)
        else:
            if S=="RRS" or S=="SRR":
                print(2)
            else:
                print(3) S=="SSR" or S=="RSR" S=="SSR" S "SSR" S=="RSR" S "RSR" print(1) print 1 if S=="RRS" or S=="SRR":
                print(2)
            else:
                print(3) S=="RRS" or S=="SRR" S=="RRS" S "RRS" S=="SRR" S "SRR" print(2) print 2 print(3) print 3 S=input() input() S
S=input()
if S=="SSS":
    print(0)
else:
    if S=="RSS" or S=="SRS":
        print(1)
    else:
        if S=="SSR" or S=="RSR":
            print(1)
        else:
            if S=="RRS" or S=="SRR":
                print(2)
            else:
                print(3)