str = input()
cnt = 0
 
for i in range(3):
  if str == 'RRR':
    cnt = 3
  elif str == 'RRS':
    cnt = 2
  elif str == 'SRR':
    cnt = 2
  elif str == 'SSS':
    cnt = 0
  else:
    cnt = 1
    
print(cnt) str = input() str input() input cnt = 0 cnt 0 for i in range(3):
  if str == 'RRR':
    cnt = 3
  elif str == 'RRS':
    cnt = 2
  elif str == 'SRR':
    cnt = 2
  elif str == 'SSS':
    cnt = 0
  else:
    cnt = 1
     i range(3) range 3 if str == 'RRR':
    cnt = 3
  elif str == 'RRS':
    cnt = 2
  elif str == 'SRR':
    cnt = 2
  elif str == 'SSS':
    cnt = 0
  else:
    cnt = 1
     str == 'RRR' str 'RRR' cnt = 3 cnt 3 elif str == 'RRS':
    cnt = 2
   str == 'RRS' str 'RRS' cnt = 2 cnt 2 elif str == 'SRR':
    cnt = 2
   str == 'SRR' str 'SRR' cnt = 2 cnt 2 elif str == 'SSS':
    cnt = 0
   str == 'SSS' str 'SSS' cnt = 0 cnt 0 cnt = 1 cnt 1 print(cnt) print cnt cnt = 2 2 cnt cnt = 0 0 cnt cnt = 1 1 cnt cnt = 3 3 cnt cnt = 0 0 cnt str = input() input() str cnt = 2 2 cnt
str = input()
cnt = 0
 
for i in range(3):
  if str == 'RRR':
    cnt = 3
  elif str == 'RRS':
    cnt = 2
  elif str == 'SRR':
    cnt = 2
  elif str == 'SSS':
    cnt = 0
  else:
    cnt = 1
    
print(cnt)