s=input()
l=[['SSS'],['RSS','SRS','SSR','RSR'],['RRS','SRR'],['RRR']]
for i in range(4):
  if s in l[i]:
    print(i)
    exit() s=input() s input() input l=[['SSS'],['RSS','SRS','SSR','RSR'],['RRS','SRR'],['RRR']] l [['SSS'],['RSS','SRS','SSR','RSR'],['RRS','SRR'],['RRR']] ['SSS'] 'SSS' ['RSS','SRS','SSR','RSR'] 'RSS' 'SRS' 'SSR' 'RSR' ['RRS','SRR'] 'RRS' 'SRR' ['RRR'] 'RRR' for i in range(4):
  if s in l[i]:
    print(i)
    exit() i range(4) range 4 if s in l[i]:
    print(i)
    exit() s in l[i] s l[i] l i print(i) print i exit() exit s=input() input() s l=[['SSS'],['RSS','SRS','SSR','RSR'],['RRS','SRR'],['RRR']] [['SSS'],['RSS','SRS','SSR','RSR'],['RRS','SRR'],['RRR']] l
s=input()
l=[['SSS'],['RSS','SRS','SSR','RSR'],['RRS','SRR'],['RRR']]
for i in range(4):
  if s in l[i]:
    print(i)
    exit()