s = list(input())

days = 0
if s[1] == "R":
  days += 1
  if s[0] == "R":
    days += 1
  if s[2] == "R":
    days += 1
    
else:
  if s[0] == "R" or s[2] == "R":
    days = 1
    
print(days) s = list(input()) s list(input()) list input() input days = 0 days 0 if s[1] == "R":
  days += 1
  if s[0] == "R":
    days += 1
  if s[2] == "R":
    days += 1
    
else:
  if s[0] == "R" or s[2] == "R":
    days = 1
     s[1] == "R" s[1] s 1 "R" days += 1 days 1 if s[0] == "R":
    days += 1
   s[0] == "R" s[0] s 0 "R" days += 1 days 1 if s[2] == "R":
    days += 1
     s[2] == "R" s[2] s 2 "R" days += 1 days 1 if s[0] == "R" or s[2] == "R":
    days = 1
     s[0] == "R" or s[2] == "R" s[0] == "R" s[0] s 0 "R" s[2] == "R" s[2] s 2 "R" days = 1 days 1 print(days) print days s = list(input()) list(input()) s days = 1 1 days days += 1 1 days days = 0 0 days days += 1 1 days days += 1 1 days
s = list(input())

days = 0
if s[1] == "R":
  days += 1
  if s[0] == "R":
    days += 1
  if s[2] == "R":
    days += 1
    
else:
  if s[0] == "R" or s[2] == "R":
    days = 1
    
print(days)