l = list(input())
a = False
b = False
c = False


if l[0] == 'R':
	a = True
if l[1] == 'R':
	b = True
if l[2] == 'R':
  	c = True
    
if a and b and c:
  	print(3)
elif (a and b) or (b and c):
  	print(2)
elif a or b or c:
  	print(1)
else:
  	print(0) l = list(input()) l list(input()) list input() input a = False a False b = False b False c = False c False if l[0] == 'R':
	a = True l[0] == 'R' l[0] l 0 'R' a = True a True if l[1] == 'R':
	b = True l[1] == 'R' l[1] l 1 'R' b = True b True if l[2] == 'R':
  	c = True
     l[2] == 'R' l[2] l 2 'R' c = True c True if a and b and c:
  	print(3)
elif (a and b) or (b and c):
  	print(2)
elif a or b or c:
  	print(1)
else:
  	print(0) a and b and c a and b a b c print(3) print 3 elif (a and b) or (b and c):
  	print(2) (a and b) or (b and c) a and b a b b and c b c print(2) print 2 elif a or b or c:
  	print(1) a or b or c a or b a b c print(1) print 1 print(0) print 0 a = True True a c = True True c a = False False a c = False False c l = list(input()) list(input()) l b = False False b b = True True b
l = list(input())
a = False
b = False
c = False


if l[0] == 'R':
	a = True
if l[1] == 'R':
	b = True
if l[2] == 'R':
  	c = True
    
if a and b and c:
  	print(3)
elif (a and b) or (b and c):
  	print(2)
elif a or b or c:
  	print(1)
else:
  	print(0)