w = input()

if w.count("R") == 3:
  print(3)
elif w.count("R") == 2:
  if w[1] == "S":
    print(1)
  else:
    print(2)
elif w.count("R") == 1:
  print(1)
else:
  print(0) w = input() w input() input if w.count("R") == 3:
  print(3)
elif w.count("R") == 2:
  if w[1] == "S":
    print(1)
  else:
    print(2)
elif w.count("R") == 1:
  print(1)
else:
  print(0) w.count("R") == 3 w.count("R") w.count w count "R" 3 print(3) print 3 elif w.count("R") == 2:
  if w[1] == "S":
    print(1)
  else:
    print(2) w.count("R") == 2 w.count("R") w.count w count "R" 2 if w[1] == "S":
    print(1)
  else:
    print(2) w[1] == "S" w[1] w 1 "S" print(1) print 1 print(2) print 2 elif w.count("R") == 1:
  print(1) w.count("R") == 1 w.count("R") w.count w count "R" 1 print(1) print 1 print(0) print 0 w = input() input() w
w = input()

if w.count("R") == 3:
  print(3)
elif w.count("R") == 2:
  if w[1] == "S":
    print(1)
  else:
    print(2)
elif w.count("R") == 1:
  print(1)
else:
  print(0)