A = list(input())

if A[0] == A[1] == A[2] == 'R':
    print(3)
elif A[0] == A[1] == 'R' or A[1] == A[2] == 'R':
    print(2)
elif 'R' in A:
    print(1)
else:
    print(0) A = list(input()) A list(input()) list input() input if A[0] == A[1] == A[2] == 'R':
    print(3)
elif A[0] == A[1] == 'R' or A[1] == A[2] == 'R':
    print(2)
elif 'R' in A:
    print(1)
else:
    print(0) A[0] == A[1] == A[2] == 'R' A[0] == A[1] == A[2] A[0] == A[1] A[0] A 0 A[1] A 1 A[2] A 2 'R' print(3) print 3 elif A[0] == A[1] == 'R' or A[1] == A[2] == 'R':
    print(2) A[0] == A[1] == 'R' or A[1] == A[2] == 'R' A[0] == A[1] == 'R' A[0] == A[1] A[0] A 0 A[1] A 1 'R' A[1] == A[2] == 'R' A[1] == A[2] A[1] A 1 A[2] A 2 'R' print(2) print 2 elif 'R' in A:
    print(1) 'R' in A 'R' A print(1) print 1 print(0) print 0 A = list(input()) list(input()) A
A = list(input())

if A[0] == A[1] == A[2] == 'R':
    print(3)
elif A[0] == A[1] == 'R' or A[1] == A[2] == 'R':
    print(2)
elif 'R' in A:
    print(1)
else:
    print(0)