S = input()
if S[0] == 'R' and S[1] == 'R' and S[2] == 'R':
    print(3)
elif (S[0] == 'R' and S[1] == 'R') or (S[1] == 'R' and S[2] == 'R'):
    print(2)
elif S[0] == 'R' or S[1] == 'R' or S[2] == 'R' or (S[0] == 'R'
                                                   and S[2] == 'R'):
    print(1)
else:
    print(0) S = input() S input() input if S[0] == 'R' and S[1] == 'R' and S[2] == 'R':
    print(3)
elif (S[0] == 'R' and S[1] == 'R') or (S[1] == 'R' and S[2] == 'R'):
    print(2)
elif S[0] == 'R' or S[1] == 'R' or S[2] == 'R' or (S[0] == 'R'
                                                   and S[2] == 'R'):
    print(1)
else:
    print(0) S[0] == 'R' and S[1] == 'R' and S[2] == 'R' S[0] == 'R' and S[1] == 'R' S[0] == 'R' S[0] S 0 'R' S[1] == 'R' S[1] S 1 'R' S[2] == 'R' S[2] S 2 'R' print(3) print 3 elif (S[0] == 'R' and S[1] == 'R') or (S[1] == 'R' and S[2] == 'R'):
    print(2) (S[0] == 'R' and S[1] == 'R') or (S[1] == 'R' and S[2] == 'R') S[0] == 'R' and S[1] == 'R' S[0] == 'R' S[0] S 0 'R' S[1] == 'R' S[1] S 1 'R' S[1] == 'R' and S[2] == 'R' S[1] == 'R' S[1] S 1 'R' S[2] == 'R' S[2] S 2 'R' print(2) print 2 elif S[0] == 'R' or S[1] == 'R' or S[2] == 'R' or (S[0] == 'R'
                                                   and S[2] == 'R'):
    print(1) S[0] == 'R' or S[1] == 'R' or S[2] == 'R' or (S[0] == 'R'
                                                   and S[2] == 'R') S[0] == 'R' or S[1] == 'R' or S[2] == 'R' S[0] == 'R' or S[1] == 'R' S[0] == 'R' S[0] S 0 'R' S[1] == 'R' S[1] S 1 'R' S[2] == 'R' S[2] S 2 'R' S[0] == 'R'
                                                   and S[2] == 'R' S[0] == 'R' S[0] S 0 'R' S[2] == 'R' S[2] S 2 'R' print(1) print 1 print(0) print 0 S = input() input() S
S = input()
if S[0] == 'R' and S[1] == 'R' and S[2] == 'R':
    print(3)
elif (S[0] == 'R' and S[1] == 'R') or (S[1] == 'R' and S[2] == 'R'):
    print(2)
elif S[0] == 'R' or S[1] == 'R' or S[2] == 'R' or (S[0] == 'R'
                                                   and S[2] == 'R'):
    print(1)
else:
    print(0)
