s = str(input())
if s == 'RRR':
    print(int(3))
elif s == 'SSS':
    print(int(0))
elif s == 'RRS' or s == 'SRR':
    print(int(2))
else:
    print(int(1)) s = str(input()) s str(input()) str input() input if s == 'RRR':
    print(int(3))
elif s == 'SSS':
    print(int(0))
elif s == 'RRS' or s == 'SRR':
    print(int(2))
else:
    print(int(1)) s == 'RRR' s 'RRR' print(int(3)) print int(3) int 3 elif s == 'SSS':
    print(int(0)) s == 'SSS' s 'SSS' print(int(0)) print int(0) int 0 elif s == 'RRS' or s == 'SRR':
    print(int(2)) s == 'RRS' or s == 'SRR' s == 'RRS' s 'RRS' s == 'SRR' s 'SRR' print(int(2)) print int(2) int 2 print(int(1)) print int(1) int 1 s = str(input()) str(input()) s
s = str(input())
if s == 'RRR':
    print(int(3))
elif s == 'SSS':
    print(int(0))
elif s == 'RRS' or s == 'SRR':
    print(int(2))
else:
    print(int(1))