s = input()
if s == 'RRR' :
    print(3)
if s == 'SRR' :
    print(2)
if s == 'RSR' :
    print(1)
if s == 'RRS' :
    print(2)
if s == 'SSR' :
    print(1)
if s == 'RSS' :
    print(1)
if s == 'SRS' :
    print(1)
if s == 'SSS' :
    print(0) s = input() s input() input if s == 'RRR' :
    print(3) s == 'RRR' s 'RRR' print(3) print 3 if s == 'SRR' :
    print(2) s == 'SRR' s 'SRR' print(2) print 2 if s == 'RSR' :
    print(1) s == 'RSR' s 'RSR' print(1) print 1 if s == 'RRS' :
    print(2) s == 'RRS' s 'RRS' print(2) print 2 if s == 'SSR' :
    print(1) s == 'SSR' s 'SSR' print(1) print 1 if s == 'RSS' :
    print(1) s == 'RSS' s 'RSS' print(1) print 1 if s == 'SRS' :
    print(1) s == 'SRS' s 'SRS' print(1) print 1 if s == 'SSS' :
    print(0) s == 'SSS' s 'SSS' print(0) print 0 s = input() input() s
s = input()
if s == 'RRR' :
    print(3)
if s == 'SRR' :
    print(2)
if s == 'RSR' :
    print(1)
if s == 'RRS' :
    print(2)
if s == 'SSR' :
    print(1)
if s == 'RSS' :
    print(1)
if s == 'SRS' :
    print(1)
if s == 'SSS' :
    print(0)