a = str(input())

if a[0] == 'R' and a[1] == 'R' and a[2] == 'R':
  print(3)
elif a[1] == 'R' and a[2] == 'R' and a[0] != 'R':
  print(2)
elif a[0] == 'R' and a[1] == 'R' and a[2] != 'R':
  print(2)
elif 'R' not in a:
  print(0)
else:
  print(1) a = str(input()) a str(input()) str input() input if a[0] == 'R' and a[1] == 'R' and a[2] == 'R':
  print(3)
elif a[1] == 'R' and a[2] == 'R' and a[0] != 'R':
  print(2)
elif a[0] == 'R' and a[1] == 'R' and a[2] != 'R':
  print(2)
elif 'R' not in a:
  print(0)
else:
  print(1) a[0] == 'R' and a[1] == 'R' and a[2] == 'R' a[0] == 'R' and a[1] == 'R' a[0] == 'R' a[0] a 0 'R' a[1] == 'R' a[1] a 1 'R' a[2] == 'R' a[2] a 2 'R' print(3) print 3 elif a[1] == 'R' and a[2] == 'R' and a[0] != 'R':
  print(2) a[1] == 'R' and a[2] == 'R' and a[0] != 'R' a[1] == 'R' and a[2] == 'R' a[1] == 'R' a[1] a 1 'R' a[2] == 'R' a[2] a 2 'R' a[0] != 'R' a[0] a 0 'R' print(2) print 2 elif a[0] == 'R' and a[1] == 'R' and a[2] != 'R':
  print(2) a[0] == 'R' and a[1] == 'R' and a[2] != 'R' a[0] == 'R' and a[1] == 'R' a[0] == 'R' a[0] a 0 'R' a[1] == 'R' a[1] a 1 'R' a[2] != 'R' a[2] a 2 'R' print(2) print 2 elif 'R' not in a:
  print(0) 'R' not in a 'R' a print(0) print 0 print(1) print 1 a = str(input()) str(input()) a
a = str(input())

if a[0] == 'R' and a[1] == 'R' and a[2] == 'R':
  print(3)
elif a[1] == 'R' and a[2] == 'R' and a[0] != 'R':
  print(2)
elif a[0] == 'R' and a[1] == 'R' and a[2] != 'R':
  print(2)
elif 'R' not in a:
  print(0)
else:
  print(1)