s = list(input())

if s.count('R') == 3:
    print(3)
elif s.count('R') == 1:
    print(1)
elif s.count('R') == 0:
    print(0)
else:
    if s[1] == 'R':
        print(2)
    else:
        print(1) s = list(input()) s list(input()) list input() input if s.count('R') == 3:
    print(3)
elif s.count('R') == 1:
    print(1)
elif s.count('R') == 0:
    print(0)
else:
    if s[1] == 'R':
        print(2)
    else:
        print(1) s.count('R') == 3 s.count('R') s.count s count 'R' 3 print(3) print 3 elif s.count('R') == 1:
    print(1) s.count('R') == 1 s.count('R') s.count s count 'R' 1 print(1) print 1 elif s.count('R') == 0:
    print(0) s.count('R') == 0 s.count('R') s.count s count 'R' 0 print(0) print 0 if s[1] == 'R':
        print(2)
    else:
        print(1) s[1] == 'R' s[1] s 1 'R' print(2) print 2 print(1) print 1 s = list(input()) list(input()) s
s = list(input())

if s.count('R') == 3:
    print(3)
elif s.count('R') == 1:
    print(1)
elif s.count('R') == 0:
    print(0)
else:
    if s[1] == 'R':
        print(2)
    else:
        print(1)