s = input()
if "R" not in s:
  print(0)
elif s[1] == "S":
  print(1)
elif s[0] == s[2] == "R":
  print(3)
elif s[0] == "R" or s[2] == "R":
  print(2)
else:
  print(1) s = input() s input() input if "R" not in s:
  print(0)
elif s[1] == "S":
  print(1)
elif s[0] == s[2] == "R":
  print(3)
elif s[0] == "R" or s[2] == "R":
  print(2)
else:
  print(1) "R" not in s "R" s print(0) print 0 elif s[1] == "S":
  print(1) s[1] == "S" s[1] s 1 "S" print(1) print 1 elif s[0] == s[2] == "R":
  print(3) s[0] == s[2] == "R" s[0] == s[2] s[0] s 0 s[2] s 2 "R" print(3) print 3 elif s[0] == "R" or s[2] == "R":
  print(2) s[0] == "R" or s[2] == "R" s[0] == "R" s[0] s 0 "R" s[2] == "R" s[2] s 2 "R" print(2) print 2 print(1) print 1 s = input() input() s
s = input()
if "R" not in s:
  print(0)
elif s[1] == "S":
  print(1)
elif s[0] == s[2] == "R":
  print(3)
elif s[0] == "R" or s[2] == "R":
  print(2)
else:
  print(1)